Activity Stream
48,167 MEMBERS
61276 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 3 of 3

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    Member

    Default [linux] Cronjobs ?

    I made a cron job to execute a script every minute.

    Code: 
    * * * * * "/home/user/crontest.sh"
    The script:
    Code: 
    date >> "/home/user/test.txt"
    sleep 10m
    As you can see, the script output the date and time to the text file "test.txt" and wait for 10 Minutes.

    Here is the output:
    Code: 
    Thu Sep 16 19:06:01  2010
    Thu Sep 16 19:07:01  2010
    Thu Sep 16 19:08:01  2010
    Thu Sep 16 19:09:01  2010
    However, I want the execution in the script to be complete before re-executing the script again.

    that's is the output should be like this:
    Code: 
    Thu Sep 16 19:06:01 2010
    Thu Sep 16 19:00:01 2010
    Thu Sep 16 19:10:01 2010
    Thu Sep 16 19:20:01 2010
    Any one knows how this can be done ??


    (I've made this just as example but I'll use the script for some other purposes)
    Snell Reviewed by Snell on . [linux] Cronjobs ? I made a cron job to execute a script every minute. * * * * * "/home/user/crontest.sh" The script: date >> "/home/user/test.txt" sleep 10m As you can see, the script output the date and time to the text file "test.txt" and wait for 10 Minutes. Rating: 5

  2.   Sponsored Links

  3.     
    #2
    You can call me G
    :\ lol run it after every ten minutes rather than every minute



    My Langotiya Yaars (Chaddi buddies): JmZ, humour, Chutad, Esotorisk, l0calhost, Daniel, Mind Freak?, TLK, Amz

  4.     
    #3
    Respected Member
    The sleep 10m really does nothing as you are not looping that script.

    So if what you are trying to do is make sure 10 minutes is passed than run it every 10 minutes as gunda said.

    If want the 10 minute loop for something else your only other choice would be create a file with last run date in it or use the creation date to check if it has been 10 minutes and then create a new file and run your code.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Linux Foundation: Linux professionals have better paychecks
    By ShareShiz in forum News & Current Events
    Replies: 0
    Last Post: 18th Feb 2012, 12:10 AM
  2. Need a Linux VPS ( USA )
    By viruz99 in forum Hosting Discussion
    Replies: 1
    Last Post: 7th Mar 2011, 02:15 AM
  3. [VPS] $5 Linux VPS | Get two Months FREE | $5 Linux VPS
    By JMimic in forum Archive
    Replies: 9
    Last Post: 25th Dec 2010, 10:40 AM
  4. RDP on linux
    By cyberz in forum Technical Help Desk Support
    Replies: 12
    Last Post: 29th Jul 2010, 01:58 PM
  5. Hai im LiNUX
    By LiNUX#1 in forum Introductions
    Replies: 8
    Last Post: 17th Jan 2010, 07:57 AM

Tags for this Thread

BE SOCIAL