How to execute a tasks if the time is 22:30:45

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • smarty

    How to execute a tasks if the time is 22:30:45

    crontab work every minute

    How to execute a tasks if the time is 22:30:45 or 22:31:01

    id | time | script
    -------------------
    4 | 22:31:01 | script0.php
    3 | 22:31:00 | script1.php
    2 | 22:30:45 | script3.php
    1 | 22:30:00 | script2.php


    My server: Apache 1.3.29, PHP 4.3.4, MySQL
  • Tim Van Wassenhove

    #2
    Re: How to execute a tasks if the time is 22:30:45

    On 2004-01-22, smarty <smarty@hot.e e> wrote:[color=blue]
    > crontab work every minute
    >
    > How to execute a tasks if the time is 22:30:45 or 22:31:01
    >
    > id | time | script
    > -------------------
    > 4 | 22:31:01 | script0.php
    > 3 | 22:31:00 | script1.php
    > 2 | 22:30:45 | script3.php
    > 1 | 22:30:00 | script2.php[/color]

    The best way is just to use crontab (for the correct syntax use the
    manual, but i think it would like this)
    01 * * * * * script0.php
    00 * * * * * script1.php
    45 * * * * * script3.php
    00 * * * * * script2.php

    Or you can make a script crontab.php and let crontab call that every
    minute (having a look at the php manual, section about date and time
    functions will provide you all the info that you need)

    --

    Comment

    • Tim Van Wassenhove

      #3
      Re: How to execute a tasks if the time is 22:30:45

      On 2004-01-22, smarty <smarty@hot.e e> wrote:[color=blue]
      > crontab work every minute
      >
      > How to execute a tasks if the time is 22:30:45 or 22:31:01[/color]



      --

      Comment

      • smarty

        #4
        Re: How to execute a tasks if the time is 22:30:45

        Tim Van Wassenhove <euki@pi.be> wrote in message news:<buoskj$jp 5g8$2@ID-188825.news.uni-berlin.de>...[color=blue]
        > On 2004-01-22, smarty <smarty@hot.e e> wrote:[color=green]
        > > crontab work every minute
        > >
        > > How to execute a tasks if the time is 22:30:45 or 22:31:01[/color]
        >
        > http://be2.php.net/manual/en/function.sleep.php[/color]

        Crontab time intervals will be checking the database every 1 min.
        If crontab check the 'schedule' table, 'tasktime' field and time is 22:34:25
        How script can extract this '25' seconds and put this to sleep(25)

        Comment

        • smarty

          #5
          Re: How to execute a tasks if the time is 22:30:45

          ok my example was wrong

          this script work stand-alone in server and don't need any browser.

          id | time | command | status
          ---------------------------------
          3 | 12:35:15 | com.php | idle
          2 | 12:34:55 | com.php | idle
          1 | 12:34:45 | com.php | idle

          cron check and time now 12:34:00

          if seconds is 00 and status idle

          run exec command

          else if seconds 01 – 59 and status idle

          count how many times 01-59 // how to make the loop
          if 2 times (12:34:45 and 12:34:55)
          sleep(45)
          run command
          sleep(10)
          run command

          next cron check 12:35:00

          Comment

          Working...