If you have record the pid of a application in a file named PID.pid, and you want to check if the process of the application still alive. You can try the following:
#!/bin/bash
if ps -p "$(< PID.pid)" > /dev/null 2>&1
then
echo "Process is running......" >&2
exit 1
else
echo "Process is not running......" >&2
exit 0
fi
| Evernote helps you remember everything and get organized effortlessly. Download Evernote. |