Jump to content

Mysql Incremental Backup With Cron


Recommended Posts

Good morning everybody,

 

I have a little mysql/cron syntax problem: I have a cron that does my wiki backup as he is told:

mysqldump -u USERNAME -pPASSWORD database2backup > backupfile.sql

Works fine. What I want to do now is to create a new backupfile every day and do put the date in the filename. What I tried:

mysqldump -u USERNAME -pPASSWORD database2backup > backupfile`date +%y%m%d`.sql

I am getting an EOF error which surely means that I am doing something wrong in the date part. Can anybody tell me the right syntax to do this?

I tested it on a Fedora Linux machine and that worked. What distribution is running on stevie? There is no way to get on the command line, right?

 

Thanks a lot!

seruemme1204

Link to comment
Share on other sites

CentOS 5. The problem is that you probably hit your process limit when doing it via cron, so it fails. Nothing you can do about that unfortunately. Make a script that runs the first command, then renames it perhaps? Users do not have SSH, so no way to really test why its failing.

 

That command has nothing wrong with it (I omitted the -P, you may or may not need that -P argument) when I run it though.

rax@rax.heliohost.org [~]# mysqldump -u rax rax_si3sys > backupfile`date +%y%m%d`.sql
rax@rax.heliohost.org [~]# ls
access-logs@		  cpbackup-exclude.conf  mail/   public_ftp/   skmaildb/			 ssl/  www@
backupfile160421.sql  etc/				   perl5/  public_html/  softaculous_backups/  tmp/
rax@rax.heliohost.org [~]#

The backupfile160421.sql is a proper dump of the database.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...