One of my small VPS was often running out it’s memory. When this occur, some processes terminating. The easiest way to find out if a daemon is running is run ps aux command and grep process name. If you got output along with process name/pid, your process is running.
The pidof command combines the ps aux and the grep command. Here is a sample script what can keeping alive your apache webserver:
You can define a cron job per minute to run your script: