-1

I put a file.sh for crontab to execute and redirecting the output into an email to my mailox. The script works when I run it manually. Unfortunately, when crontab does the job, it has the following error (from the output sent to me):

/bin/sh: /home/zenoss/zen-remote-bkup.sh: Permission denied

My crontab setup is the following:

30 11 * * * /home/zenoss/zen-remote-bkup.sh 2>&1 | mail -s "Zenoss backup replication" email@abc.com

And these are the permission on the file.sh I need to execute:

-rw-rw-r-- 1 zenoss zenoss 1433 Nov  5 10:32 zen-remote-bkup.sh
[zenoss@server1 ~]$

Does anyone know which permission I am missing? Thank you.

Tony Sau
  • 13
  • 3
  • How does it work when you run it manually? You must have typed `sh .../remote-bkup.sh` at your shell prompt rather than just `.../remote-bkup.sh`. If you have a different command in your crontab than what you typed on the command line, it shouldn't be surprising that they don't work the same way. – Keith Thompson Nov 05 '14 at 19:12

1 Answers1

0

You have to put the eXecutable bit on the script to do the job:

chmod +x /home/zenoss/zen-remote-bkup.sh
Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223