Schedule a job

Purpose

This topic describes how to schedule a job using the cron tool.

Alternative scheduling tools

Other scheduling tools can also be used. Refer to the documentation of the scheduling tool for information on how to use the tool.

Cron option

Jobs that are defined in the following format: minute hour day month dayofweek user command

Option

 

Option description

 

minute

 

The minute the job is executed.

Value: 0–59

 

hour

 

The hour the job is executed.

Value: 0–23

 

day

 

The day the job is executed.

Value: 1–31 or * for no value. Value must be valid for the month.

 

month

 

The month the job is executed.

1–12 or * for no value.

 

dayofweek

 

The day of the week the job is executed.

Value: 0 to 7 or the short name of the week such as sun or mon. Or * for no value. .

0 or 7 =Sunday,

1 = Monday, and so on.

 

user

 

The user who runs the script.

 

command

 

The command to execute. A command can be a standard Linux command or a custom script.

 

Example of a scheduled backup job

Add the following lines to schedule a backup:

# Backup the LCM system every Saturday at 1:01AM
# the backup file is in the default path /tmp/backup/
1 1 *  * 6 lps /opt/lps/current/bin/backup_lcm_system.sh

Schedule a job using cron

Task StepsPerform the following steps:

1

Log in to any local CM node as "root" user.


2

Change directory to /etc.


3

Edit the crontab file and include the job you want to schedule.

Use the format: minute hour day month dayofweek user command.


4

Restart the cron service.

Type the following command and press ENTER:

/etc/init.d/crond restart

Result:  The system prompts:

Stopping crond:                                 [  OK  ]
Starting crond:                                 [  OK  ]

End of steps



© Lucent Technologies