想让配置修改过的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 INFOcase "$1" instart)echo "start" >>/tmp/test.logsleep 1;;stop)echo "begin stop" >>/tmp/test.logsu - test -c "/home/test/scripts/shutdown.sh"echo "done stop" >>/tmp/test.l<span style="color:transparent">来1源gaodai#ma#com搞*代#码1网</span>og;;*)echo "other" >>/tmp/test.logesac执行 chkconfig test_shutdown on
以上就是机器关机或重启前时关闭mysql服务实例代码(收藏)的详细内容,更多请关注搞代码gaodaima其它相关文章!