I have a user called medusa with password *. I can successfully login to that user using
As I'd like that script to be executed automatically once every hour I created a cron job for/with that user using
Then I logged out of the user and rebooted the machine.
I see in the cron log that the cron job is being executed. However, the script fails at the stage where it is supposed to create a ZIP archive. The script is terminated and returns my own error string:
As mentioned the script runs fine if I manually execute it. Therefore, I suspect that there are some permissions problems.
Does a user require any specific permissions to run a cron job?
How can I debug this?
Thank you very much for your help.
su - medusa
and executing a script in that user's home directory. The script creates a zip archive of some files and pushes it via rsync to another location.As I'd like that script to be executed automatically once every hour I created a cron job for/with that user using
crontab -e
:
Code:
0 * * * * /home/medusa/scripts/myscript.sh > cron_log_myscript.txt
I see in the cron log that the cron job is being executed. However, the script fails at the stage where it is supposed to create a ZIP archive. The script is terminated and returns my own error string:
Code:
# Create the archive
zip -rq $archivename ${files[*]}
if [[ $? -ne 0 ]]; then
echo "Couldn't create ZIP archive"
exit $?
fi
As mentioned the script runs fine if I manually execute it. Therefore, I suspect that there are some permissions problems.
Does a user require any specific permissions to run a cron job?
How can I debug this?
Thank you very much for your help.