On a CentOS setup I have a script like this:
#! /bin/bash mysqldump --all-databases | gzip > /dumps/sql`date +"%Y-%m-%d-%$ scp `ls -t | head -1` root@backup:/media/storage/backup/
The machine is configured with an authorized ssh key so a password is not necessary. If I run it (/bin/bash mysql.sh) it works as intended, but in a cronjob only the mysqldump is carried out. The scp command fails.
Where do I look to fix this?