360教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

机器关机或重启前时关闭mysql服务案例代码(收藏)

时间:2022-10-23作者:未知来源:360教程人气:

SQL是Structured Query Language(结构化查询语言)的缩写。SQL是专为数据库而建立的操作命令集,是一种功能齐全的数据库语言。在使用它时,只需要发出“做什么”的命令,“怎么做”是不用使用者考虑的。SQL功能强大、简单易学、使用方便,已经成为了数据库操作的基础,并且现在几乎所有的数据库均支持SQL。
想让配置修改过的mysql能在机器关机或重启时能先停止mysql进程,防止数据异常

在/etc/init.d/下添加脚本,如下:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          test_shutdown
# Required-Start:    $syslog
# Should-Start: $time
# Required-Stop:     $syslog
# Should-Stop: $time
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: test_shutdown
# Description:       test_shutdown
### END INIT INFO
case "$1" in
start)
echo "start" >>/tmp/test.log
sleep 1;;
stop)
echo "begin stop" >>/tmp/test.log
su - test -c "/home/test/scripts/shutdown.sh"
echo "done stop" >>/tmp/test.log
;;
*)
echo "other" >>/tmp/test.log
esac
执行 chkconfig test_shutdown on

以上就是机器关机或重启前时关闭mysql服务实例代码(收藏)的详细内容,更多请关注php中文网其它相关文章!


学习教程快速掌握从入门到精通的SQL知识。



关键词:机器关机或重启前时关闭mysql服务案例代码(收藏)




Copyright © 2012-2018 360教程(http://www.360sd.cn) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版