I have a bash script which is run from a cron,
It is executing as I have it write to a log file which it does correctly.
I am wanting the bash script to restore a mysqldump file.
When I run the bash script manually the dump file gets loaded fine. But when I run it through the cron the mysql command appears to be ignored.
The mysqldump file is 54MB and I have checked to make sure that MYSQL is included in the global users path in /etc/profile
Does anyone know why this maybe??
Here is the bash file
#!/bin/bash
date >> /home/user/crons/crons.log
echo "Started loadbackup" >> /home/user/crons/crons.log
cd /home/user
dbuser=root
dbpass=password
dbname=databasename
filename=backup
mysql -hlocalhost -u"$dbuser" -p"$dbpass" "$dbname" < "$filename".sql
date >> /home/user/crons/crons.log
echo "Finished loadbackup" >> /home/user/crons/crons.log
My crontab looks like
02 17 * * * /home/user/crons/loadbackup.sh
Many thanks
Richard