[英]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.