Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2007
    Thanked 7 Times in 7 Posts

    Cron Job Question - No Code


    I have a question about Cron Jobs that I haven't been able to find the answer too anywhere. Is there anyway to distinguish a cron job and user from accessing my script? Like is there a way to identify if my server is reading the script or if a user is and depending on which perform a separate action? I thought of using IP's, but I don't know if a cron job has one... if that makes any sense.

    BAsically I want the script to redirect users elsewhere, but allow the cron job to run the script. I know I could just place the script where a user can't access it, but I want to see if my distinguishing method is possible.

    Any idea's?

  • #2
    Super Moderator
    Join Date
    May 2002
    Perth Australia
    Thanked 101 Times in 99 Posts
    if your cron job points to a script you can define something in that script, I normally...

    PHP Code:
    in any scripts if they are being run from cron, you could just as easily define a variable in a shell script, else check for $_SERVER vars which will not exist if its a cron/cgi job
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


    Posting Permissions

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