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 cron job or task (and what to do if it isn't running)

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

Rules for cronjobs

  • With Webhost One and Webhost Two, a task may start at most once every 10 minutes, for all your tasks combined.
  • With the Power Webhost packages, tasks may run more often.
  • Spread multiple cronjobs over time and choose a quiet moment, such as 03:17 instead of exactly midnight.
  • Heavy cronjobs that burden the server for a long time are not allowed. More websites run on the same server. If necessary, we'll stop a cronjob. So keep your tasks short and don't run them more often than needed.

Creating a cronjob

  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 runs 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

Email after each cronjob

The output of a cronjob goes to the default email account of your package, see The default email account in DirectAdmin. You can also send the output to your own address with Send All Cron Output to Email. If you don't want email, click Prevent Email when creating it, or add this after the command:

>/dev/null 2>&1

Watch out with PHP scripts

A script that runs from a cronjob doesn't know under which domain it's running. $_SERVER['SERVER_NAME'] and $_SERVER['DOCUMENT_ROOT'] are empty, and an include with a relative path can fail. So add 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 cronjob not running?

Go through these points one by one:

  1. Read the output. Temporarily remove >/dev/null 2>&1 and check the email in the default email account, or set up your own address. This often shows exactly what's 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, adjust it under Select PHP version.
  4. Test the command manually. If you have a package with Terminal, paste the command there and see what happens, see Opening SSH or Terminal in DirectAdmin. Without Terminal, open the script in your browser, or call it in the cronjob 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 Permissions of files and folders (chmod).
  6. Check the timing. Look under Cronjob is executed: to see if the task runs when you think it does. If there's an asterisk for the minute, it runs every minute and may be stopped.
  7. Check the package limit. If the task runs more often than your package allows, or takes too long, it will be cancelled. Spread the work over multiple rounds instead.
DirectAdmin doesn't keep track of when a task has run. If you want to see that, add date >> /home/gebruiker/cron-log.txt; before your command.

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

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

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…