var sidebar_align = 'right';
var content_container_margin = parseInt('350px');
var sidebar_width = parseInt('330px');
Is there a linux guru in the house?
I have the following command...
mysqldump -uUSERNAME -pPASSWORD DBNAME > /home/blws/DBNAME.sql
Now the problem is, every time this is run (by cron) it is writing over the old backup. I would like to know if it is possible to put a time stamp or something in the filename.
So the outcome would be;
Hope someone can help me
How about having 7 different cronjobs, one for each day of the week?
mysqldump -uUSERNAME -pPASSWORD DBNAME > /home/blws/DBNAME.`date +%Y-%m-%d`.sql
Hmm.. Darin - that for some odd reason isn't working
What shell are you using to run this command? Which linux distro are you using?
It will work under bash on most linux systems if the date command is in your path. Remember those `'s have to be the backwards quotes - the ones under the ~ on your keyboard...
darin - it is a CPANEL run server with red hat 7.2
and as for shell.. it is being run thru cron
Somethings amiss then - here is the about of echoing that command on a Redhat 7.2 box
[darin] $ cat /etc/issue
Red Hat Linux release 7.2 (Enigma)
Kernel 2.xx.xxxx on an i686
[darin] $ echo "mysqldump -uUSERNAME -pPASSWORD DBNAME > /home/blws/DBNAME.`date +%Y-%m-%d`.sql "
mysqldump -uUSERNAME -pPASSWORD DBNAME > /home/blws/DBNAME.2002-08-02.sql
If it's being run via cron, the shell is /bin/sh which on most boxes is /bin/bash which will run that command.
trying it through cpanel now...
the errors I recieve are..
/bin/sh: -c: line 1: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 2: syntax error: unexpected end of file
That is when I do it thru cpanel cron
Wonder why it wont work thru cron but will thru SH.. ffs
ok - use this:
mysqldump -uUSERNAME -pPASSWORD DBNAME > /home/blws/DBNAME.`date +\%Y-\%m-\%d`.sql
mysqldump -uUSERNAME -pPASSWORD DBNAME > /home/blws/DBNAME.`date '+%Y-%m-%d'`.sql
(remember normal quotes around the +%Y-%m-%d)
Fully managed UK based webhosting provider
Est 2002, 24/7 phone support, all the bells and whistles!