mac mysql 启动脚本

来源:互联网 发布:everying软件 编辑:程序博客网 时间:2024/06/05 04:51
#!/bin/bashecho "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.txtecho $?echo "mysql stop..."elif [[ $1 == "restart" ]];thenecho "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 不处理输出内容
& 位于命令行末尾 后台执行

0 0