Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    62
    Thanks
    19
    Thanked 1 Time in 1 Post

    Continous script execution on server

    Hey!

    Alright Id need your help to get around some ideas how to do it or which
    way would be the best to do it.

    I need one PHP file to run on a server on every 30mins/1h depending on
    which I choose (this can be hard coded, no matter). I simply have no idea
    how to do it on the server. I of course can create various ways of refresh
    and run it with a browser "client side" but Id like this to happen on the
    server so that I do not need any client-side actions for it.

    Thanks in advance!

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    On a unix server, I'd look into cron jobs:

    http://www.adminschoice.com/docs/crontab.htm

    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • Users who have thanked whizard for this post:

    SystemJay (09-08-2009)

  • #3
    New Coder
    Join Date
    Mar 2009
    Posts
    62
    Thanks
    19
    Thanked 1 Time in 1 Post
    Very good...
    The server is by the way Linux.
    Does this change anything or does linux has its own type of cron jobs?

  • #4
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    I think it should be the same, but I've never used them. I guess just search for how to implement it under your specific OS.



    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #5
    New Coder
    Join Date
    Aug 2009
    Posts
    26
    Thanks
    1
    Thanked 3 Times in 3 Posts
    crontab is the way to go..
    but if you run a script every 30min/hr they might remove your acces to crontab ( i am talking abt shared hosting)
    here is a tutorial on crontab
    http://linuxtuts.blogspot.com/2008/07/crontab.html

  • Users who have thanked tailender1 for this post:

    SystemJay (09-08-2009)

  • #6
    New Coder
    Join Date
    Mar 2009
    Posts
    62
    Thanks
    19
    Thanked 1 Time in 1 Post
    Ill take a look into this, thanks for both of you.


  •  

    Posting Permissions

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