hi. i have a shell script to get a mysql db dump. this script works fine when run manually

#!/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 > $fqn

but when i include this script to be run in cron job, it doesnt make the backup

this is what i included in the cron job

00 00 * * *  /home/Mysqluser/daily_dumps/bin/backup_database.sh

please explain what am i missing here.

asked 29 Feb '12, 02:04

saleemmsms's gravatar image

saleemmsms
112
accept rate: 0%

edited 29 Feb '12, 02:14

Please accept an answer or elaborate on your question. -rfelsburg

(29 Mar '12, 14:25) rfelsburg ♦



Two questions:

  1. Is your backup script run at all by cron?
    1. 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
link

answered 29 Feb '12, 16:37

Valery%20Reznic's gravatar image

Valery Reznic
212
accept rate: 0%

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.

link

answered 01 Mar '12, 04:47

dannystaple's gravatar image

dannystaple
1
accept rate: 0%

Hi, Change the cron timing to 05 00 * * * /home/Mysqluser/daily_dumps/bin/backup_database.sh. Hope it works.

--Regards, Sumit.

link

answered 21 Apr '12, 00:51

August's gravatar image

August
111
accept rate: 0%

Maybe user/group permissions on your script.

link

answered 15 Jun '12, 07:40

fatmac's gravatar image

fatmac
415
accept rate: 0%

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: 29 Feb '12, 02:04

Seen: 2,900 times

Last updated: 15 Jun '12, 07:40

powered by OSQA