How to write script with check running program
Hi,
I need to write script witch will check is program running or not, and if not then start to program. I know how do to check if program run, but don't know how to do that script start a program if it's not running. |
if [ `ps -ef | grep -o $Program_name` ]
then /etc/init.d/$Program_name start #or however you start the program fi You may have to tweak the grep part. grep -o just returns whatever was matched. You could also adjust the ps -ef part. Maybe use a ps -A then grep the output. |
Code:
pgrep program || program |
pgrep!! Genius I never new about that command. Thanks!
|
All times are GMT -5. The time now is 03:13 AM. |