在機器關機時關閉mysql服務例項

2021-07-29 19:36:52 字數 830 閱讀 2834

想讓配置修改過的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

本文出自 「月童」 部落格,請務必保留此出處

機器關機時自動重啟

最近幾天機器關機時竟然自動重啟,只好在進入系統之前再關機一次。開始沒注意,以為點錯了。後來以為中毒了,看了登錄檔啥的,也沒發現什麼東東,正打算放棄,請教一下高手呢,突然找到問題的答案了,呵呵。我的是hp的vista系統。不過估計和這個關係不是很大。網上有人總結的很好,如下 一 軟體 1 病毒破壞 2...

在linux關機時執行某個指令碼

現在把實現過程描述如下 先寫乙個指令碼放在 etc rc.d init.d下,chmod f 777 再ln s 到 etc rc.d rc0.d k01指令碼名 與 etc rc.d rc6.d k01指令碼名,同時也要 ln s 到 etc rc.d rc3.d s99指令碼名 與 etc rc...

WinXP啟動時自動開啟上次關機時未關閉的資料夾

不能自動開啟上次關機時未關閉的資料夾解決方法 首先執行登錄檔,解決方法 開啟 hkey current user software microsoft windows currentversion explorer advanced 在右面的視窗中新建dword型別鍵值 persistbrowser...