I made a short script on one server to backup a folder and send it via FTP to another server. I'm trying to set it to run every minute using crontab. It works perfectly when I run it manually, but when cron runs it, nothing appears to happen (i.e. no file received on the other end). As I said in the title, the task shows up in syslog as if everything is A-OK.
Here's the script:
#! /bin/sh
cd /root
FILENAME="backup-$(date +%b_%d_%Y_%H:%M).zip"
zip -r $FILENAME folder
ftp -in 74.131.78.127 24721 << EOF > ~/log.txt 2>&1
user myusername
binary
cd Desktop/backups
mput $FILENAME
EOF
rm $FILENAME
Crontab entry:
* * * * * /root/backup.sh
I entered this using crontab -e
.