I set up a cron script to do backups at 3AM every night, and it ran fine for a few days, then stopped. Here are the contents of the script:
Code:
#!/bin/sh
# Auth Details for FTP
USERNAME="<SNIP>"
PASSWORD="<SNIP>"
SERVER="<SNIP>"
# Create backup
tar cjf /tmp/backup/"backup_"$(date +"%d_%m_%Y").tar.bz2 /var/www*
# For testing - instant backup creation
# touch /tmp/backup/"backup_"$(date +"%d_%m_%Y").tar.bz2
# File to upload
FILE=""backup_"$(date +"%d_%m_%Y").tar.bz2"
# Upload file to backup server
ncftp -u $USERNAME -p $PASSWORD $SERVER<<EOF
mput /tmp/backup/"backup_"$(date +"%d_%m_%Y").tar.bz2
quit
EOF
rm /tmp/backup/"backup_"$(date +"%d_%m_%Y").tar.bz2
It isn't the cleanest, but I'm a novice user so
and the line in crontab -e that I put in:
Code:
0 3 * * * /root/bkup.sh
Any ideas why this happens?