mysql服务操作shell脚本

来源:互联网 发布:unity3d密室逃脱代码 编辑:程序博客网 时间:2024/04/29 08:47
#!/bin/sh. /etc/init.d/functionspath=/application/mysql/binuser=rootpass=123456function usage(){ echo "$0 {statrt|stop|restart}" echo 1}[ $# -ne 1 ] && usagefunction start_mysql(){ $path/mysqld_safe --user=mysql >/dev/null 2>&1 & if [ $? -eq 0 ]  then   action "start mysql" /bin/true else  action "start mysql" /bin/false fi}function stop_mysql(){ mysqladmin -u $user -p$pass shutdown >/dev/null 2>&1 if [ $? -eq 0 ]  then   action "stop mysql" /bin/true else  action "stop mysql" /bin/false fi}if [ "$1" == "start" ] then   start_mysqlelif [ "$1" == "stop" ]  then  stop_mysqlelif [ "$1" == "restart" ]  then  stop_mysql  start_mysqlelse  useagefi

0 0
原创粉丝点击