Web Hosting Talk







View Full Version : Cronjob! help me...


FrzzMan
03-04-2003, 09:45 PM
Can I set up a cron job use following command:

mysqldump --opt -uUsername -pPassword testdb > testsql.sql

or to execute a shell script, like this:

sh script.sh

serial
03-04-2003, 10:20 PM
Perhaps something like this would be more favorable:


#!/bin/sh

date=`/bin/date +%m-%d-%Y`

/usr/bin/mysqldump --opt -uUsername -pPassword testdb > /home/YourUsername/testsql-$date.sql


Put that in a file.sh and you can execute it with "sh file.sh" or via cron "/bin/sh /home/YourUsername/file.sh > /dev/null"

FrzzMan
03-05-2003, 08:27 AM
my host doesn't allow SSH... so I have to use this way to back up my SQL DBs...

i'll try this... thanks...

Winkie
03-05-2003, 09:08 AM
Originally posted by FrzzMan
my host doesn't allow SSH... so I have to use this way to back up my SQL DBs...

i'll try this... thanks...

/bin/sh isn't SSH.



Edit: If you don't want to recieve STDOUT via email you use > /dev/null .. if you want to recieve nothing, use &2>1 aswell (iirc)

FrzzMan
03-05-2003, 11:57 AM
I know it isn't SSH, thank for your info anyway...

It worked... thank you all...