Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

I try to set mysqldump to crontab but for some reason it's not working. maybe it's too long? I tried to put it in /etc/crontab and crontab -e mysqldump --default-character-set=utf8... how can i fix that?

asked 27 Apr '10, 17:53

S2eve's gravatar image

S2eve
37159
accept rate: 0%

edited 28 Apr '10, 22:01

Jazz's gravatar image

Jazz ♦
7811312




Does running that exact command from a command prompt as the user whose crontab you're putting the command into run correctly and without any user intervention?

--jeremy

link

answered 27 Apr '10, 18:45

jeremy's gravatar image

jeremy ♦♦
1.0k1516
accept rate: 37%

I'm not sure about the size of the command line. I would create a small shell script with the command you want to call mysqldump and place that script in cron.daily (weekly/montly/ etc)

and you would also be able to the script in crontab file with a shorter command

Also, I would check if the user you are assigning can has enough permissions (like permission to write the output file )

link

answered 27 Apr '10, 23:02

Luis's gravatar image

Luis
111
accept rate: 0%

Plus you can check if your command works without worrying about crontab, by just calling the script from the command line.

(28 Apr '10, 12:17) Amos

Can you elaborate how is not working?

On personal experience I was hit by cron running as a different user that assumed. You may want to try

su -l USER -c mysqldump --default-character-set=utf8...

a different problem I also had was that the first run took longer than the cron interval, in fact short-circuiting the backup. You may want to run the first backup from the command line and check how long it takes.

link

answered 29 Apr '10, 00:34

LiquidPaper's gravatar image

LiquidPaper
12113
accept rate: 0%

Even if the command runs as the same user in crontab as in real life, the environment may be initialized differently when cron invokes the command. For example, $PATH may be missing the directory that contains mysqldump.

link

answered 03 May '10, 14:14

seb's gravatar image

seb
111
accept rate: 0%

Try this script from Sourceforge: AutoMySQLBakcup, it works great, is easy to setup and maintain.

link

answered 25 Aug '10, 08:45

EricTRA's gravatar image

EricTRA
564
accept rate: 7%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×7
×2

Asked: 27 Apr '10, 17:53

Seen: 3,730 times

Last updated: 25 Aug '10, 08:45

powered by OSQA