Originally Posted by TB0ne
Ok...post what you've written and tried so far, and we can help.
If you're looking for hints, I'd suggest putting your script into cron so it runs every 15 minutes. There are MANY bash scripting examples of doing just this that you can easily find with a quick Google search. Have you looked there, or tried anything on your own? Just putting "linux bash script check if pid is running" brings back over 4 MILLION hits...the first hit has an example and a tutorial.
Thanks for your response.
So far i have written script (also scheduled in cron every 15 mins).
if [ -f $MYLOCKFILE ]
ps -ef | grep $pid
This script work fine in normal scenaio.
Suppose there is hard shutdown of server then interface.pid file will have process id entry.
But actually that process will not be running as it would have been terminated in hard shutdown.
As of now only we can see output in screen but script itself is not understanding whether PID is active or not.
So we want to check whatever pid is there in interface.pid file if this process is actually running it should show output as process already running.
else it should go execute stopmyapp.sh and startmyapp.sh.