SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2011
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Running a script regularly

    I need to run a script on a regular basis. It has to be compatible with php. Are there any solutions available for this? I have investigated cron, but haven't used it.

    I will be using this to run a script that looks for a field in a mysql table and when that field is larger than another field, delete the row. (I am expiring user accounts.) I am completely unfamiliar with maintenance task scheduling like this. I primarily develop under windows, but my production server is LAMP.

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Yes, a CRON job is what you would need to set-up. The only other alternative is what is a lazy mans CRON which is pretty hackish considering there is no guarantee it will run. The lazy CRON is triggered by a normal request based on some type of time frame. So if the job is suppose to run every hour the first lucky user within the hour would initiate the job when requesting a page. So depending on the task this can also make one lucky user not so happy. Most hosts have a CRON area that explains in full how to set-up an actual CRON job.
    The only code I hate more than my own is everyone else's.


Bookmarks

Posting Permissions

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