簡體   English   中英

重新生成進程時,Upstart腳本不執行預啟動腳本

[英]Upstart script not executing pre-start script when the process is respawned

重新啟動進程時,我試圖讓Upstart向我發送電子郵件。 因此,遵循新貴節,這是我的ntpd服務新貴腳本(僅作為示例):

/etc/init/ntpd.conf

### ntpd

script

mail -s "ntpd Service Respawned" my_email@gmail.com
control + D

end script

respawn

exec /etc/init.d/ntpd start

然后,我重新加載進程( initctl reload ntpd ),以便重新啟動ntpd.conf的配置。 然后kill -9以強制其重生。 這是/var/log/message.log

init: ntpd main process (12446) killed by KILL signal
init: ntpd main process ended, respawning

而且電子郵件永遠不會發送。 我已經嘗試過使用post-start和exec,但是它也不起作用。

有什么建議嗎?

echo "ntpd Service Respawned" | mail -s "ntpd Service Respawned" my_email@gmail.com

試試這個。

剛剛解決了這個問題。

我所做的是在Upstart腳本中添加以下內容:

respawn

pre-start script

mail -s "ntpd Service Respawned" my_address@gmail.com
control + D

end script

exec /etc/init.d/ntpd start

就像魅力一樣。 我認為Upstart確實非常注意語句順序。

謝謝!!!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM