Setting up a cron job with Webmin
Asked Answered
B

5

9

I am trying to setup a Cron job using Webmin to run every 5 min. It needs to target a .php file and run the php script in that file. When I enter the path to the file in the "Command" field, it doesn't work. I am just wondering what I am doing wrong, and where do I put the file path that I need the Cron job to run.

Thanks!

Backfield answered 29/4, 2011 at 13:13 Comment(0)
A
28
  1. System -> Scheduled Cron Jobs
  2. Click Create a new scheduled cron job.
  3. In Command box enter /usr/bin/php -q /var/www/path/to/your_php_script.php
  4. Click "Times and dates selected below .." radio button
  5. Click "Selected.." under Minutes section
  6. Select 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 (use control key) and click 'Save' button.
Anorthite answered 31/5, 2012 at 14:40 Comment(1)
-q mean supress HTTP header or CGI mode only, php.net/manual/en/features.commandline.options.phpLadle
S
23

A Visual Of The Question.

Here Is A Visual Of Adding A New 5 Min. Int. Cron Job In Webmin version 1.610.

San answered 27/12, 2012 at 6:47 Comment(0)
L
2

Put it in the "command" SLE (single line entry) field. When you reach the scheduling page, click [Run Now] to test.

By all means inspect records written (Webmin unit test) and certainly test (with a stub) the scheduling from Webmin, as some of the Webmin modules are a little flaky.

Lefthand answered 19/11, 2011 at 20:0 Comment(0)
V
1

im guessing you are running a linux environment. in that case you can run the command (through ssh/terminal) php /path/to/file.php.

If this works, then now the trick is to make this a scheduled command. You can do this with crontab by typing crontab -e This will then open a text editor which you can type something of the following:

@hourly php /path/to/file.php >/dev/null 2>&1

This will then run the command php /path/to/file.php every hour and detatch the process.

This is the linux way of doing it, webmin may have a way of doing this through the web ui. maybe that is what you are asking?

Venicevenin answered 29/4, 2011 at 13:23 Comment(0)
P
0

goto Webmin>System>Scheduled Cron Jabs -> 'create new scheduled cron job' and as mentioned above use php command with script as parameter to exec it

Picrotoxin answered 24/1, 2012 at 1:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.