2014-01-27 2 views
1

프로세스가 다시 생성 될 때 Upstart가 전자 메일을 보내려고합니다. 그래서, 신출내기 연 다음, 여기에 NTPD 서비스 (단지 예로서) 내 신출내기 스크립트입니다 :프로세스가 다시 생성 될 때 시작 스크립트가 사전 시작 스크립트를 실행하지 않습니다.

/etc/init/ntpd.conf 

### ntpd 

script 

mail -s "ntpd Service Respawned" [email protected] 
control + D 

end script 

respawn 

exec /etc/init.d/ntpd start 

그런 다음, 나는 ntpd.conf의 설정을 다시로드 신출내기를 얻기 위해 공정 (initctl reload ntpd)를 다시로드합니다. 그런 다음 kill -9 프로세스를 강제로 재개하십시오.

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

그리고 이메일이 전송되지 않습니다 : 여기 /var/log/message.log입니다. 나는 post-start와 exec로 시도했지만 어느 것도 작동하지 않는다.

어떤 조언이 필요합니까?

답변

1
echo "ntpd Service Respawned" | mail -s "ntpd Service Respawned" [email protected] 

보십시오.

0

방금 ​​해결되었습니다. 매력처럼 작동

 
respawn 

pre-start script 

mail -s "ntpd Service Respawned" [email protected] 
control + D 

end script 

exec /etc/init.d/ntpd start 

을 :

은 내가 한 일은 내 갑자기 출세 한 스크립트에 다음을 추가했다. Upstart는 명령문 명령에 많은주의를 기울였습니다.

감사합니다 !!!

+1

미래의 독자들에게는 OP가 동일한 upstart 스크립트에서'script'와'exec'를 모두 사용했을 수도 있습니다. 허용되지 않습니다. 수정본 (나는)이'script'보다는'pre-start'를 사용하는 것이라고 믿습니다. 주문은 큰 부분에서 중요하지 않습니다. –