Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 5 of 5

Thread: Have function running every hour - php

  1. #1

    Have function running every hour - php

    Hi everyone,

    I am not sure if my subject tells it well but i wanna create a function which will run every day or every hour to check my DB and update my Information instead of going everyday and manually check it which will consume too much time.

    Does anybody can help me in that please.

    Thanks for any help.



  2. #2
    hugeExplosions = true;

    Check the last reply, don't know if that actually works, but someones done it - guess it uses cron
    MS Paint FTW!

  3. #3
    Linux only

    1) Save the script you would like to run every hour on the server
    2) Open cron with crontab -e
    3) Add the following line (replace COMMAND with the command to execute the code)

    0 * * * * COMMAND >/dev/null 2>&1
    4) save it (a message will display: 'crontab: installing new crontab')

    done ! the script will now run every hour, more information on the crontab syntax can be found here

    You can never underestimate the stupidity of the general public.

  4. #4
    Thanks for the replies guys,
    I was wondering, im using joomla cms based and is it a good pratice to make a function which will run for e.g. every day at 00:00 to read/delete data in a DB???!!! Or should i stick with the mvc system where i will use the controller to take care of the task which means that i will have to go and instantiate that function every time i log in for e.g. on my system.

    Thanks a lot.


  5. #5
    Depends on the scripts purpose... if you really need to execute it at a specific time, use crontab (backups etc)...

    You can never underestimate the stupidity of the general public.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012