#!/bin/bash
echo "hello shell"
mysql_path=/usr/local/mysql/bin/
if [[ $1 == "start" ]];
then
$mysql_path/mysqld_safe -uroot &>./log_error.txt &
echo $?
echo "mysql start..."
elif [[ $1 == "stop" ]];
then
$mysql_path/mysqladmin -uroot shutdown &>./log_error.txt
echo $?
echo "mysql stop..."
elif [[ $1 == "restart" ]];
then
echo "mysql restart..."
else
echo "please input start|stop|restart "
fi
./mysql_server.sh start|stop|restart
$1 第一个参数
$? 前一个命令完成后的返回值,0为正常
$> stderr stdout 输出到同一个文件 1>stdout 2>stderr 输出到/dev/null 不处理输出内容
& 位于命令行末尾 后台执行