Bash – How to check to see if daemon is running

bashcrondaemon

I have a simple bash script I'd like to run as a daemon…

#!/bin/bash
while true; do
crontab cron
sleep 58m
done

I run this as a daemon using this command…

setsid copy_cron.sh >/dev/null 2>&1 < /dev/null &

[1] 17025

But once it's running, I can't find a process for it in ps -aux..?

How do I make sure the daemon is running, or kill it if I need to?

Best Answer

Simply do this

~$ nohup copy_cron.sh &

With ps awx it will appear to be running as

7168 pts/2    R      0:04 /bin/bash ./copy_cron.sh

Kill it like this

~$ kill 7168