Home > know-how > MailBeez > MailBeez Cronjob Setup

MailBeez Cronjob Setup

Cronjob Setup with Crontab

Many Servers allow to use a Crontab-like configuration.
 
 
To run MailBeez automatically by setting up a Cronjob, please use following commands
 
wget -O - -q -t 1 <mailbeez-cronjob-url>
 
or
 
elinks <mailbeez-cronjob-url>
 
or
curl -Iso /dev/null <mailbeez-cronjob-url>
 
 
To run a dedicated module separately you can address the module by adding
 
&module=<module_code>
 
to the url.
 
You find <module_code> in the URL when selecting a MailBeez Modul in the MailBeez Admin.
 
 
Note: in cronjobs you need to escape the & sign like this \&
 
Example:
 
wget -O - -q -t 1 <mailbeez-cronjob-url>\&module=<module_code>
 

 

Restricted Cronjob Setup

on some server (e.g. virtual server at host europe, GoDaddy) the cronjob feature does not allow to set a command, but a path to a file to execute.
 
following two workarounds:
 
 
1. shell script
 
create a file

cron-lynx.sh

 
with following content
 
#!/bin/sh
wget -O - -q "http://[mailbeez-cronjob-url] " > /dev/null
exit 0
 
or
 
#!/bin/sh
lynx -dump http://[mailbeez-cronjob-url] > /dev/null
 
or
#!/bin/sh
curl -Iso /dev/null http://[mailbeez-cronjob-url
 
 
 
and replace [mailbeez-cronjob-ur] with the MailBeez URL.
 
in your server admin panel set up the cronjob to call this new file:
 
<root-path>/cron-lynx.sh
 
 
2. php wrapper
 
create a file
 
cronjobwrapper.php
 
with following content
#!/usr/local/bin/php
<?php 
// create curl resource $ch = curl_init(); 
// set url 
curl_setopt($ch, CURLOPT_URL, “<mailbeez-cronjob-url>"); 
// return the transfer as a string 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
// $output contains the output string 
$output = curl_exec($ch); 
// close curl resource to free up system resources 
curl_close($ch); 
?>
in your server admin panel set up the cronjob to call this new file:
 
<root-path>/cronjobwrapper.php