Find the answer to your Linux question:
Results 1 to 7 of 7
hi I have the following problem... I have a program (c++ code) which updates some logs... I was wondering that is there a way by which i can execute this ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2007
    Posts
    15

    how to execute an application/program after a certain amount of time has passed


    hi
    I have the following problem...

    I have a program (c++ code) which updates some logs...
    I was wondering that is there a way by which i can execute this code/program after every two (or what ever time period expires )by creatiing some sort of script which runs automatically after every two hours and updates the logs by using the program ...

    I mean to say that once i run the script the program will be executed after every two hours...

    thanks
    p.s. if this forum is not for these sort of question i am deeply sorry...

  2. #2
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Sounds like a job for cron or at. "man at", "man cron", "man 1 crontab" and "man 5 crontab" for details, then come back and tell us if it's not what you want, or if it is and you need more help.

  3. #3
    Just Joined!
    Join Date
    Aug 2007
    Posts
    15

    thanks :D

    Hi

    i just looked at the man file for crontab...i think that is probably what i am looking for...I am new to Linux...so i might need a couple of days to tell you if i get it working for me...thanks so much for the help...

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Aug 2007
    Posts
    15
    hi
    i tried using cron.hourly folder in /etc to run the program by using a shell file..

    the shell file only contains the path of the program(named testme which i copied in the cron.hourly folder) which i want to run i.e.
    the contents of the shell file (which i named test.sh) are as follows

    ./testme


    but the program testme is not running ...i used chmod for both files...i did check that the cron was running... i am logged in as root user ... am i missing something...?
    thanks...

  6. #5
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Try specifying the full path instead of './'.

    Vic

  7. #6
    Just Joined! antivirus_b's Avatar
    Join Date
    Mar 2007
    Posts
    27
    I think you should read this document first.

    Newbie: Intro to cron
    cron,cron job,cron tutorial,cron unix,unix cron job.


    Maybe this document will help you to solve your probem.

  8. #7
    Just Joined!
    Join Date
    Aug 2007
    Posts
    15
    thanks
    a lot guys it did help... i did what ever there was in the tutorial...but i still can't get it working...i think i am missing something in the script... i guess i have to look for some shell scripting tutorial now...thanks a lot for helping everyone...

Posting Permissions

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