Difference between revisions of "Cron/En"

From TuxFamilyFAQ
Jump to navigationJump to search
(Applied baud123's changes on french page)
 
(One intermediate revision by the same user not shown)
Line 37: Line 37:
 
TuxFamily does not provide this service for you to break down its machines with resources-consuming batchs. Think twice to the power your script will request before scheduling it.
 
TuxFamily does not provide this service for you to break down its machines with resources-consuming batchs. Think twice to the power your script will request before scheduling it.
 
Anyway, the script will work in a somewhat restricted environment; especially, the retained priority (see `man nice') is the lowest while the maximum exection time is set to 1 hour - beyond, your script will be killed.
 
Anyway, the script will work in a somewhat restricted environment; especially, the retained priority (see `man nice') is the lowest while the maximum exection time is set to 1 hour - beyond, your script will be killed.
 +
 +
== Technically ==
 +
 +
Contrary to the Vixie cron, which run scripts at predefined time, this service use a sparse time scheduler. This is to allow us to run numerous crons by distributing their execution over time in order to prevent rush-hour and midnight-rush. Although, the specified runtime interval is only an objective, the scheduler works in "best-effort" and can delay jobs run.

Latest revision as of 20:29, 11 August 2012


Cron

Description

The "Cron Job" service, named after the famous eponymous Unix Program, allows you to execute regularly a script of yours on the TuxFamily platform. This script will be executed by your user as if you were logged using SSH. If it writes anything on standard or error output, you will receive a mail from cron@tuxfamily.net including:

  • the script's exit value;
  • the environment variables it was executed with;
  • the output itself.

Supported languages

You can use any available language you want (Bash, KSH, Perl, Ruby, Python, PHP, ...) to write the script you wish to execute, the service is simply waiting for it to be executable (however, don't forget the Shebang line).

Dependencies

Creation

Use you SSH access to create/push/test your script on the TuxFamily platform. More specifically, you have to put your script somewhere in the /home/yourproject tree. You cannot put it in your home directory.

Ensure the file created this way:

  • belongs to your Unix user (or at least to the user who will request for the job in the panel);
  • belongs to the Unix group matching your project;
  • is readable and executable by you and the members of your project and is not writable by others. Ideal permissions for a script are 770.

Then, log in TuxFamily's panel, click on the project you want to add a job to, locate the "Cron Jobs for myproject" frame and click on the "Create" link. You must then fill a 4 fields form:

  • your script's absolute path as you see it using your SSH access - this path must contain only slashes, letters (lowercase or uppercase), digits, underscores, dashes or periods. Forget accolades, brackets, accents and others non breakable spaces...
  • interval time; while the Cron program allows you to execute commands at a specifc date and time, the Cron Job service will execute your command every `n' minutes, and it is this very value you must specify in this field. If you enter a value lower than 15 minutes, the final, retained value will be... 15 minutes :)
  • the address that will receive mails if the script outputs something
  • a description... indeed, Cron Job requests are also moderated :)

Last advise: as stated when you log in using SSH:

 Be nice... the viability of this service depends on you.

TuxFamily does not provide this service for you to break down its machines with resources-consuming batchs. Think twice to the power your script will request before scheduling it. Anyway, the script will work in a somewhat restricted environment; especially, the retained priority (see `man nice') is the lowest while the maximum exection time is set to 1 hour - beyond, your script will be killed.

Technically

Contrary to the Vixie cron, which run scripts at predefined time, this service use a sparse time scheduler. This is to allow us to run numerous crons by distributing their execution over time in order to prevent rush-hour and midnight-rush. Although, the specified runtime interval is only an objective, the scheduler works in "best-effort" and can delay jobs run.