Skip to content

Cookie settings

Choose which kinds of cookies you allow. You can change your choice at any time via Cookie settings at the bottom of every page. Privacy statement

Necessary

Always on

Needed to log in, keep your cart and remember your choices. These are always on.

Which cookies?
  • weboke_sessie, weboke_klant, weboke_remember: your session and staying logged in
  • weboke_basket: your cart
  • wkBtwIncl: showing prices with or without VAT
  • wok_cookies: your cookie choice, 12 months

Measures which ad leads to a visit or order, so we do not pay for ads that do nothing.

Which cookies?
  • Google Ads via Google Tag Manager (_gcl_au, _gcl_aw), up to 90 days
  • OpenAI Ads, ads in ChatGPT
  • wok_aff: which partner referred you to us (affiliate programme), 60 days

4.6

Country and language

Each country has its own site, with prices and VAT for that country.

View

Creating a cronjob or task (and what to do if it doesn't run)

With a cron job (in DirectAdmin: Cron Jobs) you have a script run automatically at set times, for example every night. Below you can read how to create one and what to do if it doesn't work.

Rules for cron jobs

  • Have a task start no more than once every 10 minutes. We ask this of everyone, because you share the server with other websites.
  • Spread multiple cron jobs over time and choose a quiet moment, such as 03:17 instead of exactly midnight.
  • Heavy cron jobs that put a load on the server for a long time are not allowed. More websites run on the same server. If necessary, we will stop a cron job. So keep your tasks short and don't run them more often than needed.

Creating a cron job

  1. Log in to DirectAdmin and under Advanced Features click Cron Jobs.
  2. Click Create Cron Job.
  3. Fill in the minute, hour, day, month and day of the week. Always fill in the minute with a number, not an asterisk, otherwise the task will run every minute.
  4. For the command, enter the full path, for example:
    /usr/local/bin/php -q /home/gebruiker/domains/jouwdomein.nl/public_html/taak.php
    Replace gebruiker with your DA username.
  5. Click Create.
The form for a new cron job in DirectAdmin
Creating a cron job

Mail after every cron job

The output of a cron job goes to the default email account of your package, see The default email account in DirectAdmin. You can also send the output to an address of your own with Send all Cron output to E-Mail. Don't want any mail? Then click Prevent E-Mail when creating the job, or add this after the command:

>/dev/null 2>&1

Watch out with PHP scripts

A script that runs from a cron job doesn't know which domain it is running under. $_SERVER['SERVER_NAME'] and $_SERVER['DOCUMENT_ROOT'] are empty, and an include with a relative path may fail. So put this at the top of your script:

$pad = '/home/gebruiker/domains/jouwdomein.nl/public_html';
$_SERVER['SERVER_NAME'] = 'jouwdomein.nl';
$_SERVER['DOCUMENT_ROOT'] = $pad;
set_include_path($pad . PATH_SEPARATOR . get_include_path());

Is your cron job not running?

Go through these points one by one:

  1. Read the output. Temporarily remove >/dev/null 2>&1 and check the mail in the default email account, or set up an address of your own. It often says exactly what is going wrong. You can also write the output to a log file by adding >> /home/gebruiker/cron-log.txt 2>&1 after the command.
  2. Check the path. The message Could not open input file means the path to the script is incorrect. Check in File Manager: the path starts with /home/gebruiker/domains/.
  3. Check the PHP version. With /usr/local/bin/php the task uses the same PHP version as your website. If your script only works on a different version, change it under Select PHP version.
  4. Test the command manually. If your package includes Terminal, paste the command there and see what happens, see SSH access and the Terminal in DirectAdmin. Without Terminal, open the script in your browser, or call it in the cron job via curl --silent https://www.jouwdomein.nl/taak.php.
  5. Check the permissions. The script must be readable: files should be set to 644 and folders to 755. See File and folder permissions (chmod).
  6. Check the schedule. Look at Cron job will run: to see whether the task runs when you think it does. If there is an asterisk for the minute, it runs every minute. That is too often.
  7. Check how long the task takes. If a task takes a long time or starts again before the previous one has finished, it can get stuck or make your package hit its limits. In that case, split the work over multiple rounds.
DirectAdmin doesn't keep track of when a task has run. Want to see that? Then put date >> /home/gebruiker/cron-log.txt; in front of your command.

See also in the DirectAdmin manual: The default email account of your package.

Detailed explanation with screenshots: Cron Jobs: running tasks automatically in the DirectAdmin manual.

Want to learn more? Take the free WordPress course, lesson 6.3 Images, PHP and other speed gains.

Was this article helpful?

← Back to General hosting

One moment…

Set up your domains

For each domain, arrange the nameservers, the link to your hosting and who becomes the owner.

Loading your domains…