Cronjob script not being executed
I have installed a cron
job to run at 4 AM every day however it is not being executed.
If I run the script manually it executes with no problem so I don't think permissions are the issue.
I checked the log and have found the cron
is being started with the following lines
Jul 4 04:00:01 Server /USR/SBIN/CRON[30888]: (log-transfer-user) CMD (/home/log-transfer-user/scripts/execute_script.sh^M)
Jul 4 04:00:01 Server /USR/SBIN/CRON[30887]: (CRON) info (No MTA installed, discarding output)
For some reason ^M
is being appended to the path of the script. Could this be the issue?
You have carriage return (CR) at the end of the line, as the log says:
/home/log-transfer-user/scripts/execute_script.sh^M
You need to remove the CR and also put a newline after the line as needed by cron
.