Job Scheduler

The Job Scheduler provides administrators the ability to schedule recurring commands or “jobs” on their switch. A feature of the Job Scheduler is the ability to schedule a command triggered by certain pre-defined events such as switch reboot. There is no prompt for user input with this feature. Administrators using this feature can schedule such commands as enabling or disabling ports, turning on or off LEDs and Power-Over-Ethernet commands.

Syntax

HP_Switch# (config) job <name> at
job <Name> at [HH:]MM [on [MM/]DD][config-save]<Command>
job <Name> at <Event> [config-save] <Command>
no job <Name>

Schedules a command that will run automatically in the date and time given. Jobs can be scheduled to run on a recurring basis or after certain events. All commands run with manager privilege in configuration context. The 'no' form of the command deletes a scheduled job.

job

Schedule a command to run automatically in the future.

JOB-NAME-STR

The name of the job to add or delete.

at

Schedule when the job runs.

reboot

Run the job as soon as possible after every switch boot.

[HH:]MM

The time when the job should run.

on

Schedule the job to run on specified days.

MM/DD

The date when the job should run.

<-31--1>

The day relative to the end of the month when the job should run.

<1-31>

The day of the month when the job should run.

WEEKDAY-LIST

The days of the week when the job should run.

config-save

Save configuration changes made by the job.

COMMAND-STR

The command to execute when this job runs.


[NOTE: ]

NOTE: This command uses a new “weekday list” token type. A weekday list represents one or more days of the week and is stored internally. It allows users to specify a list of individual days or a range of days and use abbreviations. Examples of this weekday list are:

  • Monday,Friday

  • Mon-Wed

  • mo,we-fr,su


A pair of jobs that disable PoE during non-working hours

Switch(config)# job poe-on at 8:00 on mon-fri config-save "interface 1-24 power-over-ethernet"
Switch(config)# job poe-off at 17:00 on mon-fri config-save "no interface 1-24 power-over-ethernet"

A pair of jobs that block access to a server during weekends

Switch(config)# ip access-list extended block-server
Switch(config-ext-nacl)# deny ip any host 10.0.1.80
Switch(config-ext-nacl)# permit ip any any
Switch(config-ext-nacl)# exit
Switch(config)# job allow at 8:00 on mon config-save "no interface 1-24 ip access-group block-server in"
Switch(config)# job deny at 17:00 on fri config-save  " interface 1-24 ip access-group block-server in"

A job that blinks the Chassis Locate LED when the switch reboots

Switch(config)# job reboot-led at reboot "chassislocate blink"

A job that reboots the switch on the first day of each year

Switch(config)# job annual-reboot at 2:00 on 1/1 boot

Job Scheduler show command

Display a list of scheduled jobs or details of a single job.

Syntax

HP_Switch # show job <Name>

Job scheduler show command

HP-2620-48-PoEP# show job

Job Scheduler Status and Configuration
Scheduler Status : Waiting for the system time to be set

                   ...Event or     Save 
Name                 .Time         Cfg  ..Command
-------------------- ------------- ---- ..-------------------------------------
Burrrrrrrrrrrrrrr... reboot        Yes  chassislocate blink
baz                  reboot        No   show time 
foo                  17:00 SxTWTxS No   savepower led

Single job show command

HP-2620-48-PoEP# show job baz

Job Information
Job Name    : baz
Runs At     : reboot
Config Save : No
Run Count   : 1
Error Count : 0
Command     : show time
Output from Last Run
--------------------
Mon Jan  1 00:00:44 1990

[NOTE: ]

NOTE: Names and commands longer than their column width are truncated with an ellipsis. To assist administrators in diagnosing problems with jobs, there is a detail view for a single job. If the last job run produced any output, the first 255 characters of that output will be shown from the last job run whether that job was successful or not. A successful run will overwrite the error output from a previous failed run.


Time Adjustments

Daylight Savings Time Adjustments

When daylight savings time (DST) begins (“spring forward”), the local time jumps from 0200 to 0300. The Job Scheduler “catches up” by running all jobs scheduled between 0200 and 0300 the next time it wakes up. This prevents jobs from being skipped when they appear in the 0200 to 0300 time frame.

When daylight savings time (DST) ends (“fall back”), the local time jumps from 0200 to 0100. The Job Scheduler skips all jobs scheduled between 0100 and 0200 to allow local time to catch up. Those jobs already ran once before DST ended will not repeat.


[NOTE: ]

NOTE: If an administrator configures a new job during the repeat of the 0100 to 0200 hour on the day DST ends, the new job will not be run because the Job Scheduler skips that hour.


External Adjustments

External adjustments to the system time can happen to correct for clock drift or for other administrative reasons. The new time update can come from SNTP, from a configuration command at the CLI, or from an SNMP SET of the system time MIB object. When a time adjustment takes place, the Job Scheduler task is called with the new clock value. Jobs scheduled during a time clock jump forward are run while any jobs scheduled during a time clock jump back are skipped.

Adjustment of more than 10 minutes are considered a major change and reset the Job Scheduler. Any jobs scheduled during a time clock jump forward are skipped while any jobs scheduled during a time clock jump back are repeated.

Calendar Conflicts

Because the Job Scheduler MIB is more flexible than the CLI scheduling grammar, it is possible to create job schedules via SNMP that can’t be displayed by the CLI. The following rules are imposed on MIB values to limit them to what the CLI can display.

  1. If any bits are set in hpicfJobSchedulerEvent, all Calendar values are ignored. They may be set with SNMP, but are ignored when looking for jobs to run. The Calendar values are also ignored by the command show running-config.

  2. If any bit is set in CalendarDayOfWeek, then CalendarMonth and CalendarDayOfMonth are ignored.

  3. If no bits are set in CalendarDayOfWeek or CalendarDayOfMonth, then CalendarMonth is ignored.

  4. Only one bit may be set in the CalendarMonth, CalendarDayOfMonth, CalendarHour, and CalendarMinute objects. Attempting to set a value with more than one bit returns an InconsistentValue error.

  5. If no bits are set in CalendarHour and CalendarMinute, the job is considered to be in a transition state and not valid. This could happen when an SNMP management application is creating a job one object at a time. Jobs in this state are ignored by the scheduler and by the command show running-config.