Find the answer to your Linux question:
Results 1 to 5 of 5

Thread: Cron Job

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Cron Job

    Hi all,
    I recently got a task from my college to create a cron job to take a backup of database and directories. I am confused about what should be the periodical time to take the backup(i.e every day, week or month).

    Your help would be greatly appreciated.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    That is a question, that someone external cannot answer, because it depends on your application, db size, and most importantly: expectations on the restore.

    To put it in other words: What is the timeframe, that your stakeholders see as non-critical?

    - we do daily dumps of all our databases (mysql, postgres, mssql)
    - three versions stay locally on the respective machine, for fast restores. Older ones get deleted for space reasons.
    - There is also a daily file backup via the backup suite bacula, that includes those dumps and backups them to tape libraries for long term backup.

    One note:
    To ensure uninterupted service, you could setup replication.
    Exact implementation depends on what the workload on your setup is.
    What we do (very db read intensive usage)
    - All DB Writes go to the master mysql
    - All DB reads are served by slave mysqls
    - In our scenario: One of the slaves can pause replication. Then its dbs get dumped. Then replciation is tarted again.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Dec 2010


    I use this crip to backup database (oracle database 11gR2 on Oracle Linux ). level 0 + 1

    send your email to me, I will send scrip to you.

    it is the file .sh.
    there is a crolltab guide that help you setup auto backup.

  4. $spacer_open
  5. #4
    thanks a lot for your help. I had successfully written the script and the cron job. But the cron job is not running. I created the cron job using crontab -e command. I am also confused where this cron job is stored in the memory.

  6. #5
    Just Joined!
    Join Date
    Dec 2009
    Use "crontab -e". That will throw you into an editor (like vi). If you really don't want to use an editor, then you could do something like the following:
    crontab -l >/tmp/mycrontab
    echo "0 2 * * * /root/scripts/" >>/tmp/mycrontab
    crontab /tmp/mycrontab

    That will cause the backup script to kick off every day at 2am.

    Can you send the output of crontab -l. That will help determine why your script is not running.
    Last edited by abarclay; 12-09-2011 at 04:56 PM. Reason: corect mistake

Posting Permissions

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