If you don't want the password int he cron why don't you use a shell script. Something like this: (Call this CkTar.sh)
Code: Select all
#!/bin/sh
SERVICE='tar'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo "$SERVICE service running, everything is fine"
else
echo "$SERVICE is not running"
tar -c /volume1/TPRa | openssl enc -e -aes256 -k myverysecrepassword > /volume1/USB1/TPRa.tar.enc
fi
exit 0
This script checks to see if the process tar is running, if so, it exits. If not it then runs. Then you don't get 2, 3 or 15 instances of the app running... Now I haven't tested this, so it might need some tweaks to make it work right, but that's the best part. Those tweaks are a 1 time thing, and then it executes on the cron job's timing automatically, on time, every time with only one instance of it every running at a time. With some further tweaks you might even be able to kill a hung instance. I'll leave that to you to work out how you want it to happen, but I'm sure it's possible.