Re: [SLUG] Need Help Creating a cron job

From: steve szmidt (steve@szmidt.org)
Date: Sat Feb 24 2007 - 14:42:20 EST


On Saturday 24 February 2007 11:07, Russ Wright wrote:
> Hello All
>
> I am a little new to cron jobs. I've been reading about them but I'm
> getting a bit confused. Here is the situation:
>
> I need to create a cron job that restores a database from a sql file
> once per day.
>
> Can I do this all in one command or do I need to have a cron job call a
> script that then does the work?

As far as the cron job that's easy to answer. use 'man 5 crontab' (on most
distributions) to see the syntax. It basically comes out to :

        field allowed values
              ----- --------------
              minute 0-59
              hour 0-23
              day of month 1-31
              month 1-12 (or names, see below)
              day of week 0-7 (0 or 7 is Sun, or use names)

       A field may be an asterisk (*), which always stands for ‘‘first-last’’.

55 1 * * 1 root /root/restoremysql.sh

This will execute every Monday at 1:55am.

When you look at man pages they don't always put all on one page. If you look
at the top it tells you which one you are looking at. Like crontab(5). You
saw where in the command you put the number in my first sentence.

When you read a man page and look at the bottom you will see if there are any
others in the See Also section.

I can't tell you about your sql problem as you really did not give any
specifics to work with, plus I'm running out now. At least you have enough to
setup the cron job.

-- 

Steve Szmidt

"They that would give up essential liberty for temporary safety deserve neither liberty nor safety." Benjamin Franklin

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:35:18 EDT