I have a .sh script that creates a .tar.gz file and transfer's it to a remote server using RSA keys for authentication.
The script will run from terminal but it will not when I try to set it up as a Cron job.
I receive an email from the Cron Daemon stating this failure :
"/bin/sh: /home/backup.sh: Permission denied" , and the file is not transferred to the other server.
I have established the most likely cause from this askubuntu post that this is most likely due to the fact that "Cron" passes a minimal set of environment variables to your jobs.
The fix seems to be to include the
#!/bin/bash
PATH=/opt/someApp/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# rest of script follows
Any help with how to configure this would be greatly apprecited.
I am running Ubuntu Server 11.04
EDIT : ls -la backup.sh
gives
-rw-r--r-- 1 root root 1053 2012-10-13 15:08 backup.sh

ls -la /home/backup.shinto your question? – MadHatter Oct 15 '12 at 11:14