A Service of Softnik Technologies

Setting up the Cron Jobs

What is Cron?

Cron is a utilty that allows you to run specific jobs (scripts or commands) at specified times or periodic intervals.

Linux systems use the crontab utilty to setup cron. Our ubuntu tutorial has a section that describes the use of crontab for setting up the cron job. This requires shell access to the server.

You can also setup the cron job using a web interface if your server has a control panel (eg. cPanel).

On Windows systems you can use the Task Scheduler (schtasks) to setup the cron job. Please see the Windows Task Scheduler section below.

Please contact us if you have difficulty with cron job setup.

RunQ.php Script

The application processes the lookup queue using the runq.php script. So this should be executed at periodic intervals. You can do this using a cron job.

Here is a sample crontab entry. Remember to replace the hostname and path in the URL below with your hostname and installation path.

* * * * * wget -q -O /dev/null "http://www.example.com/wmdsed24/runq.php" >/dev/null 2>&1

You can also use PHP command line (CLI) instead of wget to run the script. If you are using PHP, remember to set the correct path to the script.

* * * * * php /home/softnik/public_html/wmdsed24/runq.php >/dev/null 2>&1

Please note that the above entries execute the script every minute. This is important because the script needs frequent control to prevent doing too many and / or too less lookups. Every time you execute the above script it will only do a very very small number of optimized lookups and exit quickly.

If the installation folder is password protected using htaccess, use the following (required only for wget / lynx)

* * * * * wget -q -O /dev/null --user xxxxxxx --password 'xxxxxx' "http://www.example.com/wmdsed24/runq.php" >/dev/null 2>&1

Make sure that you insert the url, username and password accurately.

Here is a crontab entry that uses Lynx instead of wget...

* * * * * lynx -dump http://www.example.com/wmdsed24/runq.php >/dev/null 2>&1

Enabling automatic domain whois lookups

You can automatically do lookups on domains that haven't been checked recently. To do this, simply add an extra parameter to the runq.php script, like so


The above will add all domains that haven't been checked within the last 30 days to the whois lookup queue.

The following cron job entry

* * * * * wget -q -O /dev/null "http://www.example.com/wmdsed24/runq.php?auto=90">/dev/null 2>&1


* * * * * php /home/softnik/public_html/wmdsed24/runq.php auto=90 >/dev/null 2>&1

will ensure that all your domains are refreshed every 90 days.

Remember to use this wisely. Doing too many lookups will cause your server's outbound IP to get banned. We recommend looking up domains every 60-90 days or so.

Important: Please don't make two separate cron entries for enabling automatic refresh with runq.php. You just need to add the "?auto=xx" to your existing entry for runq.php.

Though you can use the auto parameter with runq.php to refresh domains automatically, it may be better to use the makeq.php script to queue domains for lookups because makeq.php offers finer control. Please see here for more details.

Windows Task Scheduler

In Windows systems you can use the Task Scheduler to run the script. Run the following (Start > Run) to create a task. Make sure that you edit the paths as required.

schtasks /create /sc minute /mo 1 /tn "SED Queue Processor" /tr "c:\wamp\bin\php\php5.5.121\php.exe c:\wamp\www\runq.php"

The above will create a task that will execute the runq.php script every minute.

Once disadvantage of the above method is that the Windows command window will popup every time the task is run. You can prevent that using a VBS script and a batch file.

1. Create a batch (.bat) file containing the action. Let us call this runq.bat, it should contain something like...

c:\wamp\bin\php\php5.5.121\php.exe c:\wamp\www\runq.php

2. Create a VBS file that runs the batch file. We will call this runq.vbs, it should contain...

Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "c:\wamp\www\runq.bat" & Chr(34), 0
Set WinScriptHost = Nothing

3. Now create the task that runs the vbs script.

First delete any task you created earlier and then create a new task.

schtasks /delete /tn "SED Queue Processor"

schtasks /create /sc minute /mo 1 /tn "SED Queue Processor" /tr "c:\wamp\www\runq.vbs"