Determine if script ran from cron job

Discussion in 'PHP' started by SGBoise, Jul 22, 2008.

  1. #1
    Hey guys,

    I am writing a little script that will will in cron and from the web. I need to add security where if it gets ran from the web then the admin must be logged in. It's if cron then it can ignore the admin account.

    Whats the best way to determine if the cron job launched the script. I don't want to use query strings because I had a lot of trouble trying to get query strings to work on my web host.

    Thanks.
     
    SGBoise, Jul 22, 2008 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Check to see if a user agent is recorded? Don't just rely on that though.
     
    matthewrobertbell, Jul 22, 2008 IP
  3. wdillsmith

    wdillsmith Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'd probably just have the script email me with details (when, who, etc.). You could also configure the output in the cron to append to a log file
     
    wdillsmith, Jul 22, 2008 IP