Kris Anderson asked:
I’m running a bash script on an ubuntu 12.04 through cron. The script works fine for a few weeks (runs daily backups of websites, mysql databases, and copies to Amazon S3).
However, twice now I’ve noticed that backups stopped happening. Both times the backup script (backupscript.sh) located in my home folder was no longer there. No one else has access to this server, so nothing was manually changed on the server and no one deleted the file by mistake.
The cron job (nano /etc/crontab) still references this script, but the script itself disappears.
What could cause this to happen? Does Ubuntu delete the script if it runs into some sort of error?
Did you check the script for obvious things like
rm $0? It sounds like the backup script is deleting itself.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.