2

I have following crontab entry which does not work. Please can anybody help?

@midnight scp /home/xxx/file.txt xxx@yyy:~/zzz/file.txt_`date +"%m-%d-%y"`

This command works very well when run from command line. This is trying to backupo file to another machine every day with current date appended to it.

0

1 Answer 1

2

There's a little-known, but documented feature of cron: if you put a percent sign in a command, it's interpreted as a newline. You need to protect it with a backslash.

@midnight scp /home/xxx/file.txt xxx@yyy:~/zzz/file.txt_`date +"\%m-\%d-\%y"`

Alternatively, put the command in a script and write just the path to the script in the crontab file.

0

Not the answer you're looking for? Browse other questions tagged .