Web Analytics Made Easy -
StatCounter Creating Cron Jobs with PHP - CodingForum

Announcement

Collapse
No announcement yet.

Creating Cron Jobs with PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating Cron Jobs with PHP

    I would like to set up a cron job that queries a game server every X seconds and then saves the info, so that later I can process the data to create a report of the game server.

    I dont want the servers to be queried constantly, but only when requested for.

    I see 2 ways of doing this:

    a) create an admin page where a cronjob can be created and set to run once. ie queryserver.php?ip=x.x.x.x&port=xxx

    b) have the cron job running forever and make an admin page so that the server ips can be added to an SQL database. Then the cronjob will check the database every X seconds for which servers to query and then query them.

    I guess we will only use this a few times a week to track a game server while we are playing a match on it, so which is the most efficient way of doing it? And, can you plz provide some links to guides on doing it or I'll just google it if you let me know what to look for.

    tyvm

  • #2
    having looked into i think it is not possible to setup a cronjob using a php page, am i wrong?

    this means i need a cronjob that runs for eternity to continually query whatever servers are in the database???

    and then another cron job to make sure the first cronjob is active, and if not activate it???

    or use 'ignore_user_abort' ???
    Last edited by fatrat; Sep 29, 2006, 06:15 PM.

    Comment


    • #3
      It is possible to edit the crontab file just like any other file on a server - assuming you know its location and have permission to write to it.

      It might be easier to set up a cron that runs every x seconds and runs a php script that checks a database to see which game servers its needs to query (if any)
      Theres very little overhead in running a small script that checks to see if it needs to do anything
      http://www.hazelryan.co.uk

      Comment


      • #4
        Another option is to run it whenever someone vists the site or whenever 10 people vist the site if it's a busy site.

        ~Phil~
        Lusci.Com :: System Development Solutions

        Comment

        Working...
        X