welcome: please sign in

Diff for "MemberManual/UsingCron"

Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2007-10-28 00:39:39
Size: 698
Editor: MichaelOlson
Comment: Outline
Revision 4 as of 2007-11-14 03:47:39
Size: 1474
Editor: MichaelOlson
Comment: Add PATH tp cron example
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
Cron needs a special configuration file to tell it how to operate. Cron needs a special configuration file to tell it how to operate.  It is suggested that this file be called {{{~/.crontab}}}, though it can have any name.
Line 15: Line 15:
TODO: Describe format.  Suggest calling this file {{{~/.crontab}}}. For an explanation of the format of this file, run:

{{{
man 5
crontab
}}}
Line 19: Line 23:
TODO: crontab ~/.crontab. Once you are satisfied with your setup, run the following command to activate your changes, assuming that your configuration file is called {{{~/.crontab}}}:
Line 21: Line 25:
= Exmaples = {{{
crontab ~/.crontab
}}}
Line 23: Line 29:
TODO: Give examples, based on example given near the end of MemberManual/RunningUnattendedCommands. = Examples =

One convention for making scripts to run commands in their own PAG, as specified by the [:MemberManual/RunningUnattendedCommands:Running Unattended Commands page], is to create the {{{~/scripts}}} directory, and place your scripts there. Then, make a cron configuration file that looks something like this.

{{{
PATH=/afs/hcoop.net/common/bin:/usr/local/bin:/usr/bin:/bin

09 0 * * 0 run-in-pagsh --fg ~/scripts/clean-mail
11 0 * * 0 run-in-pagsh --fg ~/scripts/remove-tmp
12 0 * * 0 run-in-pagsh --fg ~/scripts/weekly-comment-check
*/10 * * * * run-in-pagsh --fg ~/scripts/make-git-projects
}}}

This page describes the basic use of cron on HCoop systems.

TableOfContents

Prerequisites

It is very important that you read the [:MemberManual/RunningUnattendedCommands:Running Unattended Commands page] to understand the general idea of how to run unattended commands on Mire.

Making a cron configuration file

Cron needs a special configuration file to tell it how to operate. It is suggested that this file be called ~/.crontab, though it can have any name.

For an explanation of the format of this file, run:

man 5 crontab

Activating your cron configuration

Once you are satisfied with your setup, run the following command to activate your changes, assuming that your configuration file is called ~/.crontab:

crontab ~/.crontab

Examples

One convention for making scripts to run commands in their own PAG, as specified by the [:MemberManual/RunningUnattendedCommands:Running Unattended Commands page], is to create the ~/scripts directory, and place your scripts there. Then, make a cron configuration file that looks something like this.

PATH=/afs/hcoop.net/common/bin:/usr/local/bin:/usr/bin:/bin

09 0 * * 0   run-in-pagsh --fg ~/scripts/clean-mail
11 0 * * 0   run-in-pagsh --fg ~/scripts/remove-tmp
12 0 * * 0   run-in-pagsh --fg ~/scripts/weekly-comment-check
*/10 * * * * run-in-pagsh --fg ~/scripts/make-git-projects

MemberManual/UsingCron (last edited 2019-01-14 19:16:18 by ClintonEbadi)