Viewing 1 to 8 of 8 items
Tag Archives: Ef

Check if program is running with bash shell script?

This is an example of a bash script which checks for some running process (daemon or service) and does specific actions (reload, sends mail) if there is no such process running. check_process(){ # check the args if [ “$1” = “” ]; then return 0 fi #PROCESS_NUM => get the process number regarding the given  Full Article…

0

ps -ef | grep to check if process is running

The script. #! /bin/sh #check the processes and email me if nsexpress is not running if ps -ef | grep “ns-httpd -d /usr/netscape/suitespot/https-lls/config” then echo “nsexpress is running” |mail george.rajapaksa at lls.edu else #echo “nsexpress is not running ” |mail george.rajapaksa at lls.edu cd /usr/netscape/suitespot/https-lls;./start fi The Problem: if pgrep -f “ns-httpd -d /usr/netscape/suitespot/https-lls/config” pgrep  Full Article…

0

Remove grep from grep output of ps command

You might always see the “grep” as the list of processes when you grep for a particluar process. $ ps -ef | grep xscreensaver jsaikia 4050 1 0 May14 ? 00:00:00 xscreensaver -nosplash jsaikia 14282 14245 0 16:54 pts/2 00:00:00 grep xscreensaver If you want not to print it the output, you can do “grep  Full Article…

0