Mysqldump fails as a cron job - a work around
Archive - Originally posted on "The Horse's Mouth" - 2009-06-30 08:05:31 - Graham EllisHere's a curiosity ... running a mysqldump as a crontab job, nothing happens on one of our servers. Now I HAVE included the full path to the executable file in my crontab line, and I have redirected the output to a full path ... so something else is tripping it up.
What do I do? An Internet search and I discover that I'm not the first to have the problem (I didn't expect that I was) and that although no definite solution has been found on the places that I'm visiting (someone ditched MySQL and went to PostGRESql instead!!). it's suspected as being something to do with the rudimentary shell environment that cron provides.
I'm on a time-scale today, so rather that spend a long time finding out what was happening, I decided to spend a shorter time achieving what I needed in another way (a.k.a. a work around!). By writing a short script that includes the MySQLdump, I can get the MySQLdump to run under a full bash shell. And I can easily call up that script from cron.
Problem not explained / solved exactly ... but I have achieved what I need.