Answers to: shell script of mysqldump works fine when run manually, but does not run in the cron job ?http://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job<p>hi. i have a shell script to get a mysql db dump. this script works fine when run manually</p> <pre><code>#!/bin/sh fqn=/home/Mysqluser/daily_dumps/bookstore_`date +%Y%m%d_%H%M%S`.sql.gz mysqldump -u root -h localhost -pmysql#passwd bookstore | gzip &gt; $fqn </code></pre> <p>but when i include this script to be run in cron job, it doesnt make the backup</p> <p>this is what i included in the cron job</p> <pre><code>00 00 * * * /home/Mysqluser/daily_dumps/bin/backup_database.sh </code></pre> <p>please explain what am i missing here.</p>enFri, 15 Jun 2012 07:40:04 -0400Answer by fatmachttp://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job/2867<p>Maybe user/group permissions on your script.</p>fatmacFri, 15 Jun 2012 07:40:04 -0400http://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job/2867Answer by Augusthttp://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job/2851<p>Hi, Change the cron timing to 05 00 * * * /home/Mysqluser/daily_dumps/bin/backup_database.sh. Hope it works.</p> <p>--Regards, Sumit.</p>AugustSat, 21 Apr 2012 00:51:35 -0400http://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job/2851Comment by rfelsburg on saleemmsms's questionhttp://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job#2812<p>Please accept an answer or elaborate on your question. -rfelsburg</p>rfelsburgThu, 29 Mar 2012 14:25:37 -0400http://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job#2812Answer by dannystaplehttp://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job/2797<p>Did you find any emails/logs from the cron job showing what error messages/output was made? If so - can you add them to your question.</p>dannystapleThu, 01 Mar 2012 04:47:25 -0500http://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job/2797Answer by Valery Reznichttp://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job/2794<p>Two questions:</p> <ol> <li>Is your backup script run at all by cron?</li> <li> <ol> <li>If yes, where mysqldump located? usually cron has very limited PATH, so if mysqldump located say in /usr/local/bin it's unlikely be found in the PATH by cron. Then either specify full path or set in the script PATH environment variable</li> </ol> </li> </ol>Valery ReznicWed, 29 Feb 2012 16:37:11 -0500http://linuxexchange.org/questions/2792/shell-script-of-mysqldump-works-fine-when-run-manually-but-does-not-run-in-the-cron-job/2794