Results 1 to 5 of 5

Thread: Backup script

  1. #1
    Join Date
    Jun 2008
    Location
    Dublin, Ireland
    Posts
    298

    Default 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:

    Code:
     
    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

  2. #2
    Join Date
    Jun 2008
    Location
    /dev/belgium
    Posts
    1,946

    Default Re: Backup script

    did you make it executable?

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,798

    Default Re: Backup script

    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.
    Henk van Velden

  4. #4
    Join Date
    Jun 2008
    Location
    Dublin, Ireland
    Posts
    298

    Default Re: Backup script

    It wasn't executable - doh! Thanks everyone for their help..

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,798

    Default Re: Backup script

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •