Find the answer to your Linux question:
Results 1 to 3 of 3
Hi to all. I want to run a php file through crontab. I know some basic things about cron.but need some more details. I have a dedicated server for one ...
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    2

    setting up cron to run php files

    Hi to all.
    I want to run a php file through crontab.
    I know some basic things about cron.but need some more details.
    I have a dedicated server for one of my client running Debian on it.
    I want to run a php script where it will update some database tables in a 10 or 5 min interval of time. the best bet here is to run that script through crontab.
    i know it will be something like this:
    10 * * * * /usr/local/bin/php /var/www/html/cron.php
    but now how could i setup this cron file to run properly.
    And is the above command is right and will work.
    how to run cron under a normal user,mean to create a file like cron.allow OR cron.deny

    Any details will be appreciated.

    Thanks

  2. #2
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    The cron file is the crontab. You edit the file with the command:

    Code:
    crontab -e
    It'll put you in your default editor. The command you gave:

    10 * * * * /usr/local/bin/php /var/www/html/cron.php
    is wrong. It'll run at 10 minutes after the top of each hour (ex 2:10, 3:10, 4:10, etc). What you want is:

    0-59/10 * * * * /usr/local/bin/php /var/www/html/cron.php
    This says to run at minute 0 and step in 10 minute intervals. Look at the manpage for crontab for details:

    man 5 crontab
    You shouldn't have to do anything with cron.allow or cron.deny. I believe the default is to allow all users to set up crontabs.

  3. #3
    Just Joined!
    Join Date
    Jun 2008
    Posts
    2
    Thanks vsemaska.
    I was aware of that to setup mins.
    Also i think we can put like */10.It will run after 10 min every hour.
    i will try your solution as you mention.
    I tried it also from some sources of google.but i think the problem was coming from PHP execution directory.
    I am going to try on other linux distro.
    Hope it will work.

    Thanks buddy for your time.

Posting Permissions

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