Quote:
Originally Posted by AusFreak
Its now 2018 and this won't work on centOS
remove " | grep -v grep " and it seems to work now for anyone in the future
|
you do not want to do this as it will create a false positive and will always try to start shoutcast... even if its already running...
the idea is only try to start IF its not running.
when the script checks the list of running processes
code:
ps auxwww | grep "/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf"
if sc_serv is running it will return 2 lines, one line that matches the sc_serv process
and one line that matches the ps auxwww command that you just executed.
if sc_serv is not running, it will return only the ps command you just executed, both resulting in a 'true' result.
the script has a ! at the beginning which means do something if there are no results or 'false' result.
if sc_serv is NOT running, then run it... and the only way it can tell if its NOT running is if you run
code:
! ps auxwww | grep "/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf" | grep -v grep
the grep -v grep ensures that when running ps, it will not return itself as a running process...
i hope that makes sense..