Using Cron job.

Re: Using Cron job.


I have written a script in php which searches through a table and sends
people an email reminders about certain events.

To run the script everyday ( actually twice a day) I guess that I need
to use cronjob ?

Is that a VirtualMin function or Webmin ?
Does anyone know how I go about setting this up ?


Yup! A cron job would handle that well.

And you can certainly do that within Virtualmin.

If you log in as the Virtual Server owner, go into Webmin Modules -> Scheduled Commands, and you can setup a command to run there at what ever interval you require.



OK I have found the Create Cron Job
under Webmin.

I have assigned the appropiate user the one that has access to
the database.

Now it says “Command” and “Input to command”.

I want tp run a php script file
which is at

Do I put that url into the Command box ?

You rarely want to use the “input to command” field – in fact, I’d go as far as saying you should probably just ignore that field for now :slight_smile:

You can put your command, and all it’s parameters, into the “Command” field.


probably more like:

php -q /home/

if you want to output whatever the script does you can use:

php -q /home/ >> /home/

Depending on whether the cron relies on any of the apache environment variables, you can either use the php commands mentioned already, or you can use the command below to run the script via the url

(this is in the command box btw)

wget -O - > /dev/null

that will trigger the script, and discard any output that is received, if the script generates a response you want to keep, you can replace /dev/null with the logfile you want to use, and use >> instead of > if you want to have an ongoing log, rather then just the last run