community.egroupware.org: Community wiki

  
Community wiki
Asynchronous timed service

Asynchronous timed service


The asynchronous service is a very practical feature of eGroupWare which allows a user to send emails, for example, without having to log in. Immediately following the installation only the ‘fallback (after each page view)’ is available. This means that if, for example, an email alarm has been set for an appointment, the email will be sent as soon as a user realizes an action in eGroupWare. There is a problem, however, if the alarm has been set for a time in which no one is using eGroupWare. The fact that the email cannot send itself is due to the program language in which eGroupWare is written. PHP scripts will be carried out only when they are called up. It is possible to circumvent this but it would require quite a bit of work to reconfigure.

There is, however, one simple possibility to solve this problem: cron. Cron is a service which is installed in every Linux server. This is how it works:

  • An entry is made into the crontab table which states how often a program (in this case a PHP script) should be called up.
  • The cron service regularly looks up whether a program needs to be started. If it is the case, the program is opened.

To set up a crontab entry for eGroupWare you must have the necessary authorization on the server. In practice this means that this installation feature is not available for normal web space.

If crontab entries can be made, you can configure the service as follows:

  • In the time designation line enter the desired set up. In most cases the default should suffice. If it needs to checked more often than every five minutes for email to be sent, you will need to change the minute field from ‘*/5’ to ‘*/2’, for example. IMPORTANT: The more times this service is executed, the more the server suffers. It should never be necessary to input a value lower than five minutes. You can also raise the value to say ‘*/15’ which means that a check will occur every 15 minutes to determine whether an action needs to be carried out.
  • Click on Install crontab.
  • To test, click on [Start testJob]. If everything works, in the meantime you should receive the email you sent (as mentioned above).
  • If everything functions as it should, click on [Cancel testJob], unless you want to clutter your mailbox.

Installation with Windows


In order to actually maintain the timed asynchronous service in Windows and not return to fallback mode (after every page is set up), you have to input a task which runs phpgwapi/cron/asyncservices.php through the system every five minutes. Verify that Task planner service is started (control panel >> administration >> services) and open the Taskmanager (all programs >> utilities >> system programs >> planned tasks). Click on Add task, search through your file system for phpcli.exe and select it. Initially, allow the task to run daily and click twice on [more] till you get to username/password. At this point, you must log in a user who has permission to read your eGW directory (it is best to employ the same user which you used for the webserver). Click [more], check off Extended features... and confirm with [Completed]. Enter the following on the command line Start:

<Pathway to php installation>\phpcli.exe [-c <path to php.ini>] <eGW Installation directory s>\phpgwapi\cron\asyncservices.php <eGW Domain>

If we assume that the path is c:\php and phpcli finds the correct php.ini, you should see this:

c:\php\phpcli.exe c:\apache2\htdocs\egroupware\phpgwapi\cron\asyncservices.php default

Select the tab Time plan and click on [Extended]. Check off Repeat interval and change it to every five minutes, then change the period to 24 hours. This way the asyncservices.php will be executed every five minutes. Now you can log into eGW and proceed to Admin >> Asynchronous timed service. After you have manually installed the task, now select Turned off (not recommended) in order to run the timed asynchronous service. By clicking on [Update] you can verify if the asynchronous service (still) was executed through ‘crontab’.



User Manual / Administration

The user manual is written by Outdoor Unlimited Training GmbH, who also offers support together with Stylite AG, see eGroupWare support.
You are here