Skip to content

Instantly share code, notes, and snippets.

@nuxwin
Last active November 19, 2017 04:43
Show Gist options
  • Save nuxwin/fcbbdd3a94a1d594e14236d949ad719f to your computer and use it in GitHub Desktop.
Save nuxwin/fcbbdd3a94a1d594e14236d949ad719f to your computer and use it in GitHub Desktop.
i-MSCP Cronjobs plugin documentation

i-MSCP CronJobs plugin v2.0.0

Provides a cron time-based job scheduler for administrators and customers.

Introduction

This plugin provides a cron time-based job scheduler for administrators and customers.

The administrators give cron permissions to resellers, and the resellers give cron permissions to their customers, according their own permissions.

Administrators can also add their own cron jobs, using their own interface which is less restricted than the customer interface. Administrators can choose the user to use for cron jobs execution while the customers cannot.

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

Requirements

i-MSCP Serie ≥ 1.6.x (plugin API ≥ 1.5.1)

Pre-requisites for jailed cron environment

  • i-MSCP InstantSSH plugin ≥ 6.0.0

Installation

  1. Be sure that all requirements are met
  2. Upload the plugin through the plugin management interface
  3. Install the plugin through the plugin management interface

Depending on your system, and if the support for jailed cron environment is available, the installation can take up to several minutes.

Update

  1. Read the UPDATE.md file
  2. Be sure that all requirements are met
  3. Upload the plugin through the plugin management interface

Depending on your system, and if the support for jailed cron environment is available, the update can take up to several minutes.

Jailed cron environment activation

If this plugin is already activated, and if you want enable the support for jailed cron environment, you must follow these steps:

  1. Install the required InstantSSH plugin version
  2. Deactivate and re-activate this plugin through the plugin management interface

Cron environments

The cron environment is the place from which a cron task is executed. Depending of your setup, the plugin can provides one or two types of cron environments:

  • Standard
  • Jailed

Standard cron environment

The standard cron environment has nothing special. Cron jobs are executed on the system has usually. That cron environment is best suitable for trusted users as it is less secure than the jailed cron environment.

Jailed cron environment

The jailed cron environment provides better security level than the standard cron environment. The cron tasks are executed inside a restricted environment (chroot) from which it is theorically not possible to escape. This should be the prefered cron environment for untrusted users.

By default, and if the support for jailed cron environment is available (see below), the plugin will create a jailed cron environment that provides:

  • GNU Wget
  • PHP (CLI) and PHP extensions (the same available for the system PHP)
  • MySQL CLI and mysqldump
  • A set of common UNIX utilities

It is of course possible to make other commands available in the jailed cron environment. See the InstantSSH plugin documentation for further details.

Availability

The jailed cron environment is only available when the InstantSSH plugin is installed. This plugin make use of the jail builder library that is provided by the InstantSSH plugin.

For the resellers, as for the customers, the jailed cron environment is always available, regardless of the cron environment that is permitted:

  • jailed: Only the jailed cron environment is available.
  • standard: Both standard and jailed cron environment are available.
Fallback

If a reseller or customer does have access only to the jailed cron environment but the requirements for this environment are not met, the plugin will fallback to the standard environment, regardless of what the interface say.

Cron job types

There are two types of cron job: Url and Shell

URL cron job type

The Url cron job type make customers able to execute commands through GNU Wget. The commands must be valid HTTP(s) URLs. That cron job type is always available, regardless of the cron job type that is permitted for a customer:

  • Url: Only the Url cron job type is available.
  • Shell: Both Url and Shell cron job types are available.

Shell cron job type

The Shell cron job type make customers able to execute commands through the Shell interpreter which by default can be Dash or Bash, depending of your distribution.

Crontab(5) files

The plugin handles the crontab(5) files automatically. You must bear in mind that any manual change made in a crontab file that 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 a cron task is added for the user it belongs to.

Configuration

See the config.php file inside the archive.

If you change a configuration parameter in the plugin configuration file, you must not forget to trigger a plugin list update through the plugin management interface, else your changes won't be taken into account.

License

i-MSCP CronJobs plugin

@author Laurent Declercq <[email protected]>
@copyright (C) 2014-2017 Laurent Declercq <[email protected]>
@license i-MSCP License <https://www.i-mscp.net/license-agreement.html>

See the LICENSE file inside the archive for further details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment