|
Stange behaviour noted when using service
Hi all,
I am using linux service to start a program. However different behaviors are observed when the service is started automatically upon startup/reboot and when the service is called manually through "service myservice start".
Script to startup my program(Name:myprog)
-----------------------------------------------------------
1 while(application is down)
2 do
3 "start my application" #script will stop here if program is running(script can still be found when i perform a "ps"
4 echo "rebooting" >> log.txt
5 done
Startup script(Name:myservice)
-----------------------------------------------------------
Simply call myprog
Via startup/reboot
------------------------------------------------------------
The application gets started however, in the event when the application crashes, the script will terminate at line 3 instead of printing out "rebooting" in log.txt. When i perform a "ps", both the script and program can no longer be found.
Via manual startup-"service myservice start"
------------------------------------------------------------
The application also gets started. However when the application crashes, the same script continue with line 4 and "rebooting" is printed in log.txt. When i perform a "ps",both the script and program can still be found.
I have done all the necessary setup, eg creating a service script(myservice) in /etc/init.d, and adding it using chkconfig.
Sorry for the long post.
Any help is greatly appreciated! Please advise.
Cheers!
Last edited by hhilo2002; 03-23-2009 at 12:19 AM.
|