CRONTAB, ack!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

CRONTAB, ack!

Post by JPlush76 »

Hey there..
I'm trying to install a cronjob to backup my mysql database. I created a shell script that looks like this

Code: Select all

#!/bin/sh

mysqldump -uroot -pPassword --opt DB1 > /home/jim/back.sql

rm /home/jim/testfile

exit 0
I chmod the file to make it executable then I crontab -e and put in
*/2 * * * * /home/jim/jimsql

and save it, it says crontab installed. Basically I'm looking to test it so I set it for every 2 minutes to run. I set up a testfile in the directory just so I know if its gone every two minutes my cron is working.

Well the RM command works in this file but the MySql backup does not. However when I call it from the command line ./jimsql

Boommmm, the file is there and everything works great. Any thoughts as to why this wouldn't work running as a crontab? :(
thanks all!
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

ahh nevermind, I have to use the FULL path to the mysqldump

/usr/local/bin/myqldump


works now :)
Post Reply