Hey Listees,<br><br>I have a question (hopefully quite simple) about the system V init scripts in /etc/init.d. I have an app installed and for some reason it had no system V init script. It has been installed a long while now so I can't quite remember whats going on but basically I remember I wrote the init script my self and the app is enabled as a service which chkconfig to run at system levels 3, 4 and 5. However when I wrote the script I only ever added a "start" and "stop" clause to it (why I can't remember?), now I need to add a "restart" clause but I'm having an issue. <br>
<br>I have pasted the code below from my "restart" clause but from what I can tell, it is killing the app but not restarting it, I think because the killing process is still in action so when it start the app again it just gets killed straight away. If I enter "/etc/init.d/my_app restart" the app is terminated but does not start again, entering "/etc/init.d/my_app start" immediately after fires it up straight away so there is no problem there; can someone suggest a better way as my scripting is very begginnerish (if thats a word) and I don't doubt for a second I am doing this in a very inefficient manner:<br>
<br><snipety snip snip><br><br>restart)<br>echo -n "Stopping my_app: "<br>pgrep my_app | while read PIDS; do # I have chosen this method because my_app spawns various child processes <br>kill -9 $PIDS # and they all need to DIE! (Killing the parent process would kill the child processes<br>
done # however there are actually two parent processes so this seems like a good idea?)<br>echo -n "Starting my_app: "<br>/usr/local/my_app/sbin/my_app_bin &<br>exit $?<br>
;;<br><br><snip snap snorum><br clear="all"><br><br>Any input is greatly appreciated!<br><br>Regards,<br>James ;)<br><br>-----BEGIN GEEK CODE BLOCK-----<br> Version: 3.1<br>GIT/MU/U dpu s: a--> C++>$ U+> L++> B-> P+> E?> W+++>$ N K W++ O M++>$ V- <br>
PS+++ PE++ Y+ PGP t 5 X+ R- tv+ b+> DI D+++ G+ e(+++++) h--(++) r++ z++<br>------END GEEK CODE BLOCK------<br>