creating cron job

This is a discussion on creating cron job within the Tech Board forums, part of the Community Boards category; hi, I have written one cron.txt in which i have put Code: 1,5,10,15 * * * * /root/foo.sh then typed ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    28

    Smile creating cron job

    hi,
    I have written one cron.txt in which i have put
    Code:
               1,5,10,15 * * * * /root/foo.sh
    then typed
    crontab cron.txt
    to lad the cron job.
    and also foo.sh contains a command to run a C program executable.
    This is not working.Please guide me to write a cronjob which will run after every 5 mins to run the script foo.sh

    Thank You,
    Nitin

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,530
    http://www.hmug.org/man/1/crontab.php
    Check these files

    /var/cron/allow
    /var/cron/deny

    If you're not allowed, or denied, then you can't use cron.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    28
    Salem ,
    I have /etc/cron.d/cron.deny which is empty.this means I can execute crontab command.
    I followed following steps.
    Code:
               1) I created foo.sh shell script which runs a expect script for SCP.And it is running      successfully.
                2) then I created  cron.job which contains.
                              1,5,10 * * * *  /root/foo.sh
                     this means I want to execute foo.sh at 1,5,10 mins 
                3)  then loaded this job by executing 
                             crontab cron.job

  4. #4
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Hmmm, I was unaware that one could create a separate file that would load the cron job. I have always just done crontab -e (as root, which it looks you are too) then added the line to the root user file (that'd be something along the lines of */5 * * * * /root/foo.sh).

    When crontab is complete, it signals crond to reload the config file that was just edited.

    Also, your script will need to be executable, and no assuptions can be made about the path that you use. You'll either need to use fully qualified filenames or set the environmental variable PATH at the top of your script.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. crazy pipe/fork
    By fortune2k in forum C Programming
    Replies: 8
    Last Post: 03-13-2009, 11:28 AM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 03:49 PM
  4. a VB.NET job
    By Brain Cell in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 05-09-2005, 06:41 PM
  5. I can't find a job.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 42
    Last Post: 06-29-2003, 08:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21