Need professional help

Discussion in 'PHP' started by deriklogov, Jun 23, 2009.

  1. #1
    My target is to run about 10 scripts thru cron , but those scripts can not be run at the same time, so before every script run I am doing check to make sure that non of them are running.

    What I did - I created flag.txt file which every script could access and in case some of the scripts are running - script leaving flag '1', when it finished the job it leaving flag '0'. So if another script is trying execute during first script is running - it just stop working, but my problem is --

    Let say cron run 1st script at 10:00 , another script should start at 10:15, how I can delay the start of the another script if at 10:15 the first script is still running ?
    in my script I am just using

    if (check the flag)
    {run script if flag OK}
     
    deriklogov, Jun 23, 2009 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    Have one big script running as cron job , in turn that big scripts will start your scripts one by one .
     
    it career, Jun 23, 2009 IP
  3. deriklogov

    deriklogov Well-Known Member

    Messages:
    1,080
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    130
    #3
    How I can do that ?
     
    deriklogov, Jun 24, 2009 IP
  4. Sky AK47

    Sky AK47 Member

    Messages:
    298
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    45
    #4
    Have the script in the order you want to have them executed in a big cron, no need for checking.
     
    Sky AK47, Jun 25, 2009 IP
  5. deriklogov

    deriklogov Well-Known Member

    Messages:
    1,080
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    130
    #5
    any samples would be appreciated, thank you
     
    deriklogov, Jun 25, 2009 IP