0

I'm implementing an automatic backup feature. I can run this command from the command line:

aws ec2 create-snapshot --volume-id=vol-abc123 --description=backup$(date +"%d-%m-%Y")

It creates a snapshot with a description like backup01-01-2017

But running this command through cron like:

0 0 * * *    aws ec2 create-snapshot --volume-id=vol-abc123 --description=backup$(date +"%d-%m-%Y")

It says:

/bin/sh: 1: Syntax error: Unterminated quoted string

If I remove the $(date +"%d-%m-%Y") from the command it works again:

0 0 * * *    aws ec2 create-snapshot --volume-id=vol-abc123 --description=backup

How can I make $(date +"%d-%m-%Y") to work from cron?

Pipe
  • 101

0 Answers0