User Tools

Site Tools


plugins:cronjobs

This is an old revision of the document!


CronJobs Plugin

This documentation is for to the latest version available in our plugins store. For an oldest documentation, see the README.md file inside the plugin archive.

Introduction

This plugin provide a cron time-based job scheduler for i-MSCP.

Administrators give cron job permissions to their resellers, and the resellers give cron job permissions to their customers according their own permissions. For instance, a reseller will be able to give the full cron job permission to a customer only if he has also this permission.

Administrators can also add their own cron jobs using their own interface which is less restricted than the customer interface in the sense that they can set the UNIX user to use for the cron job execution while the customers cannot.

Each cron job is added in the crontab file ( see crontab(5) ) that belongs to the UNIX user under which the cron command must be run. For customers, this is the Web user as created by i-MSCP.

Requirements

  • i-MSCP >= 1.1.21 ( plugin API >= 0.2.15 )

Requirements for jailed cron jobs support

  • InstantSSH plugin >= 3.1.0

Note: It is not necessary to activate the InstantSSH plugin. Only its presence is required.

Debian / Ubuntu packages

  • libpam-chroot
  • makejail
  • msmtp

You can install these packages by executing the following command:

# aptitude install libpam-chroot makejail msmtp

Notes

  1. If support for jailed cron jobs is detected and a package is not installed on your system, an error will be throw
  2. The msmtp package is required to allow cron to send email notifications from the jailed environment

Installation

1. Login into the panel as admin and go to the plugin management interface 2. Upload the plugin archive 3. Activate the plugin

Update

1. Backup your plugins/CronJobs/config.php configuration file 2. Login into the panel as admin and go to the plugin management interface 3. Deactivate the plugin 4. Upload the plugin archive 5. Restore your plugins/CronJobs/config.php configuration file ( compare it with the new version first ) 6. Activate the plugin

Activation of jailed cron jobs support

If this plugin is already activated and if you want enable support for jailed cron jobs later on, you must follow these instructions:

1. Be sure that all required packages as mentioned in the requirements section are installed on your system 2. Upload the InstantSSH plugin 3. Deactivate this plugin 4. Re-activate this plugin

Cron job types

Three types of cron jobs are available, which are in order: URL, Jailed and Full.

URL

The URL cron jobs are always available. They allow to schedule URL commands executed via GNU Wget. The commands must be valid HTTP(s) URLs.

Note: When a customer has permission for jailed cron jobs, the URL cron jobs are run inside the jailed environment, else they are run outside the jailed environment. This is by design, and this do not change anything from the customer point of view.

Jailed

The jailed cron jobs allow to schedule Shell commands which are run through the Shell interpreter in a jailed environment. By default the plugin will create a jailed environment which provides:

  • GNU Wget
  • PHP (CLI) and some PHP modules ( mysqlnd, pdo, gd, intl, json, mcrypt, mysql, mysqli, pdo_mysql, readline )
  • Mysql monitor and mysqldump
  • A set of common UNIX utilities

Note: Only one jailed environment is created for all jailed cron jobs. The most important here, is that the cron jobs cannot broke the whole system.

Availability

The jailed cron jobs are available only when the InstantSSH plugin is also present on the system, whatever it is activated or not. The CronJobs plugin reuses the jail builder library which is provided by the InstantSSH plugin to manage the jailed environment.

The jailed cron jobs doesn't apply to administrators.

Full

The full cron jobs are identical to the jailed cron jobs, excepted the fact that the Shell commands are not run inside a jailed environment. Such cron jobs should be reserved to trusted users.

Crontab files

The plugin handles the crontab files automatically. You must note that any manual change made in a crontab file which is under the control of this plugin will be automatically overridden on next processing. Therefore, once that a crontab file is under the control of this plugin, you must use the cron jobs interface provided by this plugin to add, edit or delete a cron job in this file.

A crontab file is under the control of this plugin as soon as you add a cron task for the user to which it belong to, through the cron jobs interface provided by this plugin.

Interfaces access

Cron jobs permissions interface

The cron job permissions interface allow to give cron job permissions, either to the resellers in the context of the administrators, or to customers in the context of resellers.

* Administrators can access the cron job permissions interface through the Customers menu * Resellers can access the cron job permissions interface through the Customers menu

Note: When cron job permissions are updated, any cron job which doesn't fit with the new permissions are simply deleted. For instance, if the execution frequency of a specific cron job is lower than the new cron jobs frequency limit,the cron job is automatically removed.

Cron jobs interface

The cron jobs interface allows administrators and customers to add, edit and delete cron jobs.

* Administrators can access the cron jobs interface through the System tools menu * Customers can access the cron jobs interface through the Webtools menu

Translation

You can translate this plugin by copying the [l10n/en_GB.php](l10n/en_GB.php) language file, and by translating all the array values inside the new file.

Feel free to post your language files in our forum for integration in a later release.

Note: File encoding must be UTF-8.

Plugin Usage

A small contribution for use of this plugin is requested by doing a donation on my paypal account ( [email protected] ). If you do not want to contribute, you should not use that plugin.

License

i-MSCP CronJobs plugin
copyright (c) 2014 laurent declercq <[email protected]>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

See lgpl v2.1

Sponsors

Author(s)

* Laurent Declercq l.declercq@nuxwin.com

Nuxwin 2014/12/30 05:27

/var/www/virtual/i-mscp.net/wiki/htdocs/data/attic/plugins/cronjobs.1419913675.txt.gz · Last modified: 2014/12/30 04:27 by nuxwin