seruemme1204 Posted April 19, 2016 Posted April 19, 2016 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
seruemme1204 Posted April 21, 2016 Author Posted April 21, 2016 Good morning, it would be a great help to know which linux distribution is running on stevie. Anybody? Thanks!seruemme1204
wolstech Posted April 21, 2016 Posted April 21, 2016 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. 1
seruemme1204 Posted April 21, 2016 Author Posted April 21, 2016 Thanks wolstech, I liked the way because it was all in one. But renaming should make it as well.
seruemme1204 Posted April 22, 2016 Author Posted April 22, 2016 Argh, I still do not get it working: DATE=a && mv backup.sql backup_$DATE.sql This works and creates a backup_a.sql. DATE=`date +%y%m%d` && mv backup.sql backup_$DATE.sql This does not. I get an EOF error. Is there something wrong with the syntax? Thanks!seruemme1204
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now