I've currently got a SFTP script that uploads the latest version of a file to a server via SSH which runs on a cron daily. However I always get emails like this (I changed the server to example.com fyi)
/etc/cron.daily/backup:
Connected to example.com.
Connected to example.com.
The relevant part of the script looks like this:
sftp -o "IdentityFile=~/.ssh/backup" -q backup@example.com > /dev/null << COMMANDS
cd weekly
put /srv/backups/daily/$INSTANCE-$(date +%Y%m%d).tgz
quit
COMMANDS
It does this twice since it's in a for loop and replaces the $INSTANCE
variable with two different names, thus the two Connected to example.com.
messages in the cron.
I'd prefer not to print everything to /dev/null
since I'd like to get errors in my email. The thing I can think of is by piping to grep and greping for error or failure or something. Is that the only possible alternative?
Any help would be great!