Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Crontab - Scheduling tasks.
Results 1 to 3 of 3

Thread: Crontab - Scheduling tasks.

Hybrid View

  1. #1

    Crontab - Scheduling tasks.

    hi all,
    i made a crontab PET - it is over there ->
    http://www.linuxjunior.org/cgi-bin/p...play&id=69

    please let me know if any errors are in there,
    thanks!

    Updated 5 Arpil 2006
    Created July 15, 2002
    Okay - You want to run a program at a certain time everyday or perhaps every week and you don’t want to
    have to remember to do it. Perhaps you wish to delete a bunch of temporary files, syncronize your computer
    or send out mail notifications. Maybe you hear people talking about cronjobs or crontab and you wish to
    know what it is
    Crontab entries looks complex but they are really simple, infact they are as simple as shown below:
    Code:
    minute hour dayofmonth month dayofweek command_1;command_2;...command_n
    The entries you may have seen look like this:
    17 * * 3 0 cat ~/mail/inbox > ~/old_mail;gzip ~/old_mail
    Well it looks intimidating for someone unfamilar with it, first there are several numbers, a fairly long UNIX
    command with a strange~ and then another command with another strange ~
    Well the first five fields are times when they events are scheduled to occur and then come the commands.
    The first five fields are in order as shown below:
    1. minute 0-59
    2. hour 0-23 (midnight is zero, 11:00 PM is 23)
    3. dayofmonth 1 - 31
    4. month 1 - 12
    5. dayofweek 0 - 6 (0 is Sunday, 1 is Monday etc.)
    Many times you will see crontab entries that have astericks (*) in them, these are wldcards, which means that
    events will occur at any time. If you wanted an command to run every minute you could by entering an
    crontab entry that looks like this:
    * * * * * command
    But that is pretty boring, lets have a command that a a bit more practical, one nice thing to on a regular basis
    for me is backup files. I want to do this on a monthy basis at 3:00 AM and lets do this on the 15th of every
    month.
    Here would be my crontab entery would look like this:
    * 3 15 * * cd ~pbharris; tar -cf backup.tar *;gzip backup.tar
    Here the hour is 3 AM and the day of month is the 15th and since there is an asterick at the other positions
    they not have any effect. The commands seperated by a semi-colon are as follows:
    1. cd to the user pbharris’ home directory (hense the tilda ~
    2. create a tar (tape archive) file named backup.tar
    3. compress the tar file with gzip.
    To create any crontab entry the comamnd is
    crontab -e
    and to view ones crontab entries the command is
    crontab -l
    Here is what one looks like, you can have as many as you like, each on seperate lines.
    1 of 2 09/04/2002 07:39 PM
    Linux Junior - Your community driven Linux site! http://www.linuxjunior.org/cgi-bin/p...UBMIT=Display&...
    Code:
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/crontab.30483 installed on Mon Jul 15 22:21:01 2002)
    # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
    0 * * * * cd /home/pbharris/ghclient099_linux; ./ghclient.x -nice 19 > /dev/null 2> /dev/null
    * 3 15 * * cd ~pbharris/docs/pets/; tar -cf backup.tar * ;gzip backup.tar
    Last edited by pbharris; 04-06-2006 at 01:32 AM.

  2. #2

    Re:Crontab - Scheduling tasks.

    I read it and it looks good. Just one miniscule error that may cause problems for newbies if they try to incorporate your example, it's this:

    Code:
    * 3 15 * * cd ~pbharris; tar -cf backup.tar;gzip backup.tar
    There is no file list for the tar command. I guess you meant it to be ''*'' like in your crontab listing further down. I tried it on my box (wel,l for all I know maybe it defaults to backing the whole of the current directory). This is what it said to me:
    tar: Cowardly refusing to create an empty archive
    LOL!

  3. #3

    Re:Crontab - Scheduling tasks.

    damn you are good!!
    fixed and thanks again!

Similar Threads

  1. Crontab - Scheduling tasks.
    By peter in forum Tutorials
    Replies: 0
    Last Post: 11-24-2008, 05:35 AM
  2. Scheduling macros, Anyone have one?
    By chicagomike in forum Windows - General Topics
    Replies: 0
    Last Post: 08-02-2005, 02:04 PM
  3. Need help with crontab
    By montejr in forum Linux - General Topics
    Replies: 1
    Last Post: 11-25-2003, 10:50 PM
  4. Crontab not working
    By mcdougrs in forum Linux - General Topics
    Replies: 9
    Last Post: 09-14-2002, 03:47 PM
  5. scheduling tasks
    By cameron in forum Linux - General Topics
    Replies: 6
    Last Post: 03-22-2002, 06:22 PM

Bookmarks

Posting Permissions

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