Greetings List!
Hey I have a cron issue I can't resolve. I have a standalone Debian
machine that I use as a PostgreSQL server for a bunch of different
databases. Up until a few weeks ago, this data really wasn't a critical,
but now it's become very important, so I need to back it up. I had been
doing a simple dump in cron like so:
30 4 * * * pg_dump -d FSDetail | gzip > /var/tmp/FSDetail.gz
There are no problems with it, and if the system died, I figured that I'd
be able to either get to the actual database or to the backup, or recreate
it without too much headache. But like I said, it's become critical. I
would like automagic serialized backups so I want to do something like this:
cp /var/tmp/FSDetail.gz /backup/PostgreSQL/`date +FS%y%m%d.gz`
This give me a file like FS050316.gz, FS050317.gz, etc. The /backup
directory is an SMB share on a NAS server that is routinely backed up.
However if I put this into cron:
30 6 * * * cp /var/tmp/FSDetail.gz /backup/PostgreSQL/`date
+FS%y%m%d.gz`
or
30 6 * * * 'cp /var/tmp/FSDetail.gz /backup/PostgreSQL/`date
+FS%y%m%d.gz`'
or
30 6 * * * "cp /var/tmp/FSDetail.gz /backup/PostgreSQL/`date
+FS%y%m%d.gz`"
or even
30 8 * * * cp /var/tmp/FSDetail.gz /backup/PostgreSQL/$(date
+FS%y%m%d).gz
I get something similar to this:
/bin/sh: -c: line 1: unexpected EOF while looking for matching `''
/bin/sh: -c: line 2: syntax error: unexpected end of file