Backup script

Hi,

I have a backup script to back up a mysql database. I have it setup up as a cron job. I am getting mails from cron like:

 
Date: Mon,  1 Jun 2009 22:00:07 +0100 (IST)

/bin/sh: /home/user/scripts/backup.sh: Permission denied


Do I have to be root to run the script? I thought cron jobs ran as root anyway… Should they be root? Is that a bad idea…?

Suggestions welcome…

/jlar

did you make it executable?

Cron jobs run for the user who set them in their crontabs. So when you edited as root the root crontab, it will run as root. But when you edited as enduser the crontab of enduser, it runs under enduser.

The crontab entries in /etc/cron.* are run under root (enduser wouldn’t have the permission to create something there).

A backup run for a MySQL database should eithet be owned/run by user mysql or root. When mysql can do everything you shouldn’t do it as root (old wisecrack).

And of course when you mention something to be executed from any crontab that owner must have read and execute access to that file. So some r and x bits in the right places might be handy like microchip8 suggested allready.

It wasn’t executable - doh! Thanks everyone for their help…

What I do not understand is how you tested it. Trying to run it directly (not in cron) must gave the same problem.