Expand|Select|Wrap|Line Numbers
- ps -ef | grep sc_serv | grep -v grep | awk '{print $2}' > sc_serv.pid
- cat sc_serv.pid
- 3447
- 3449
What I'd really like is for when this system boots up, it will check for the PID file. I'm guessing if it exists, and its a fresh boot, then it will kill the file, and start it under the user specified (automagically). I don't think I would have to check if the process exists.
I was also wondering if it would be a good idea to monitor this process to test if its alive. I've not had issues with it dying on its own in the past, so I think I can forgo checking on it every now and then.
Id still like this ran under the specified user under 'screen' mode so that if need be i can interact with it. I also have some other console type programs which I will need to interact with.
Here's the sc_cast process start file:
Expand|Select|Wrap|Line Numbers
- cat ../scast
- cd $HOME/shoutcast_serv
- screen -A -m -d -S scast ./sc_serv
If making a 'service' call out of this would work, that would be nice too, so that I can do something like 'service shoutcast start' and 'service nsv start' (two main purposes for this script) then that would be awesome, but running these under the user I need would be priority - I don't want them running under 'root'.
Help is appreciated.