Problem With Script In cron.daily

Help
2011-10-19
2013-05-29
  • fullmoonguru
    fullmoonguru
    2011-10-19

    I just installed & configured automysqlbackup and it looks like it's working fine when I run it manually.  But I'm confused by the script to put in cron.daily as in the readme file:

    1. Create a script as below called runmysqlbackup using the lines below:
    #~~~~ Copy From Below Here ~~~~
    #!/bin/sh
    /usr/local/bin/automysqlbackup /etc/automysqlbackup/myserver.conf
    chown root.root /var/backup/db* -R
    find /var/backup/db* -type f -exec chmod 400 {} \;
    find /var/backup/db* -type d -exec chmod 700 {} \;
    #~~~~~ Copy To Above Here ~~~~
    2. Save it to a suitable location or copy it to your /etc/cron.daily folder. 
    3. Make it executable, i.e. chmod +x /etc/cron.daily/automysqlbackup.
    

    My path is different than /var/backup…  I assume I need to change that to my path.  Here are my questions:

    1. What is db*?  Can I just list my path all the way to my folder called automysqlbackups instead?

    2. Why am I chowning & type f'ing etc.  Do I need that?  I assumed that if the script ran fine manually you would just put a copy in the cron.daily folder so it would run once a day.

    I tried just changing the path & got permission errors.  The backup directory is not protected so there should be no problems.

     
  • Harley
    Harley
    2011-10-20

    To answer Q2 - You are running those commands to set permissions on the backup files (-type f) and directories (-type d) so that, in the example, only root has access to the backup files..

    To answer Q1 - The "/var/backup/db*" is simply the path to where you have chosen to store your backups.. Correct it as needed for your setup..

    All you really need in the cron.daily script is..

    1
    2
    #!/bin/sh
    /usr/local/bin/automysqlbackup /etc/automysqlbackup/myserver.conf
    

    With the paths checked that they are correct for your setup, specifically that you are pointing to the correct .conf file..

    Then make it executable and you are good to go..

    To test it you can always run the script in the cron.daily folder from the command line..