Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

cron

hi !
i wanna aknow how to use cron.
actually i wanna execute an executble file (say a.out) at specified intervals(can be dily ,after 2 hours, after 4 hrs etc).
i also wanna know about crontab. how cron and crontab differs.

Comments

  • XfactorXfactor Member Posts: 343
    : hi !
    : i wanna aknow how to use cron.
    : actually i wanna execute an executble file (say a.out) at specified intervals(can be dily ,after 2 hours, after 4 hrs etc).
    : i also wanna know about crontab. how cron and crontab differs.
    :

    Here is the explaination of cron and crontab.
    cron is the whole facility, which includes the crontab utility and the cron daemon.
    The cron daemon runs every minute and if a program needs executed, then cron executes that program. crontab is the utility used to manage a users cron file. To edit the crontab file, you run the command:
    shell> crontab -e
    The man page will help you understand what these values mean a little better but here is what a crontab file would look like.

    #minute hour day month weekday /path/to/script
    30 23 * * * /path/to/script

    The 30 is minutes, and the 23 is the hour so this script would execute at 23:30 every night. So if you need a script to run every 2 hours, then you will probably need to do something like,

    * 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path/to/script

    I don't think there is an easier way than to enter every hour.
    Hope this helps and I hope I didn't confuse you. I tend to over explain.

    X
  • abcabc Member Posts: 443
    : So if you need a script to run every 2 hours, then you will probably need to do something like,
    :
    : * 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path/to/script
    :
    : I don't think there is an easier way than to enter every hour.
    : Hope this helps and I hope I didn't confuse you. I tend to over explain.
    :
    : X
    :

    easier way: specify the interval and the step like in:[code]
    * 0-23/2 * * * /path/to/script[/code]
  • XfactorXfactor Member Posts: 343
    : : So if you need a script to run every 2 hours, then you will probably need to do something like,
    : :
    : : * 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path/to/script
    : :
    : : I don't think there is an easier way than to enter every hour.
    : : Hope this helps and I hope I didn't confuse you. I tend to over explain.
    : :
    : : X
    : :
    :
    : easier way: specify the interval and the step like in:[code]
    : * 0-23/2 * * * /path/to/script[/code]

    This is a lot easier. I didn't know it could be done this way. This is my new bit I learned today.

    X
  • satishkhatrisatishkhatri Member Posts: 31
    i have an executable file and i don't know how to make a script.can u please tell me.
    : : : So if you need a script to run every 2 hours, then you will probably need to do something like,
    : : :
    : : : * 0,2,4,6,8,10,12,14,16,18,20,22 * * * /path/to/script
    : : :
    : : : I don't think there is an easier way than to enter every hour.
    : : : Hope this helps and I hope I didn't confuse you. I tend to over explain.
    : : :
    : : : X
    : : :
    : :
    : : easier way: specify the interval and the step like in:[code]
    : : * 0-23/2 * * * /path/to/script[/code]
    :
    : This is a lot easier. I didn't know it could be done this way. This is my new bit I learned today.
    :
    : X
    :

Sign In or Register to comment.