Nathan Riley
asked on
CRON Job Keeps Failing
mysqldump -u root -ppassword theipb | gzip -c > /home/domain/public_html/_ db_backups /$(date "+%Y%M%d%H%m").theipb.sql. gz
The above command runs fine from ssh, but when added as a cron job on simple control panel it never completes. Is there a syntax error in it for the control panel?
The above command runs fine from ssh, but when added as a cron job on simple control panel it never completes. Is there a syntax error in it for the control panel?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Unescaped '%'s are converted to newlines and everything after the first is sent to the command as standard input. See the man page for crontab(5).
For crontab jobs to run successfully, and in your case, please do the following:
create a shell script file
set required env variables in it (or you may source a .profile file using . /path/to/.profile)
add the above command to it (use full pathnames for command, etc)
make the script executable
add it as a crontab job by referring to its full pathname
you may read the crontab log file to check for error messages , or you mar redirect standard error to a file ( 2> /path/to/mylogfile)
create a shell script file
set required env variables in it (or you may source a .profile file using . /path/to/.profile)
add the above command to it (use full pathnames for command, etc)
make the script executable
add it as a crontab job by referring to its full pathname
you may read the crontab log file to check for error messages , or you mar redirect standard error to a file ( 2> /path/to/mylogfile)
you may use >> & 2>> for redirection of output and standard error rather than > & 2> to accumulate output and error messages
Make sure you define your PATH var in your crontab to ensure the.binaries are found