Scheduler

Overview

The scheduler allows you to define and set a timetable for maintenance activities such as the following:

  • Quality of service (QoS) policy changes

  • Data backup

  • Saving a configuration

Jobs

Jobs consist of a single command or multiple commands that define routine activities. Jobs can be scheduled one time or at periodic intervals. The scheduler defines a job and its timetable as follows:

  • Job—A routine task or tasks defined as a command list and completed according to a specified schedule.

  • Schedule—The timetable for completing a job. You can assign multiple jobs to a schedule. A schedule is defined as either periodic or one-time only:

    • Periodic mode—A recurring interval that continues until you delete the job. You can configure the following types of intervals:

      • Daily—A job is completed once a day.

      • Weekly—A job is completed once a week.

      • Monthly—A job is completed once a month.

      • Delta—A job begins at the specified start time and then at specified intervals (days:hours:minutes).

    • One-time mode—A job is completed only once at a specified time.

Features

  • Logs - The scheduler maintains a log file containing the job output. If the size of the job output is greater than the size of the log file, the output is truncated.

  • Remote User Authentication - Before starting a job, the scheduler authenticates the user who created the job. Since user credentials from a remote authentication are not retained long enough to support a scheduled job, you need to locally configure the authentication passwords for users who create jobs. These passwords are part of the scheduler configuration and are not considered a locally configured user.

    Before starting the job, the scheduler validates the local password against the password from the remote authentication server.

  • High Availability - Scheduled jobs remain available after a supervisor switchover or a software reload.

  • Default Settings -

    This table lists the scheduler default settings.

    Parameters Default
    Scheduler state Disabled
    Log file size 16 KB

Guidelines and Limitations

The scheduler has the following configuration guidelines and limitations:

Prerequisites

  • You must enable any conditional features before you can configure those features in a job.

  • You must have a valid license installed for any licensed features that you want to configure in the job.

  • You must have network-admin user privileges to configure a scheduled job.

General Guidelines

  • The scheduler can fail if it encounters one of the following while performing a job:

    • Verify that you have configured the time. The scheduler does not apply a default timetable. If you create a schedule and assign jobs and do not configure the time, the job is not started.

    • While defining a job, verify that no interactive or disruptive commands (for example, copy bootflash: file ftp: URI , write erase , reload , and other similar commands) are specified because the job is started and conducted noninteractively. When a reload job is scheduled for a given time and executed, the switch goes into a boot loop. Hence it should not be used in scheduler configuration.

  • The scheduler accepts start_time in the past for any schedule with a repeat option in the time command under the schedule mode configuration. It then throws a warning that the entered start time is in the past. The start_time of any schedule will always remain the same as it was in the beginning, across reboot, and even after reapplying the previous saved configuration.

  • Beginning in Cisco NX-OS Release 9.3(5), a second space is included in the output of the scheduler job configuration CLIs.

    Previously, the output had only one space before the job configuration CLI:

    scheduler job name show_fds.
     show clock >> bootflash:show_fds
    ^ (single space)

    Now it has two spaces before the job configuration CLI:

    scheduler job name show_fds.
      show clock >> bootflash:show_fds
    ^^ (two spaces)

    There is no impact on the functionality of the scheduler in the NX-OS software for configuration replace, ISSU, reload, and so on. But if you are using a script to read the output of the show run command for reading the scheduler component configuration, then you must update the logic in the script to allow for the extra space.

Enable or Disable the Scheduler

You can enable the scheduler feature so that you can configure and schedule jobs, or you can disable the scheduler feature after it has been enabled.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal
		switch(config)#
					

Step 2

Enable or disable the scheduler using the command [ no ] feature scheduler

Example:

switch(config)# feature scheduler
					

Step 3

Display the scheduler configuration using the command show scheduler config

Example:

switch(config)# show scheduler config
		config terminal
		feature scheduler
		scheduler logfile size 16
		end
					

This is an optional step.

Step 4

Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
					

This is an optional step.


Define Scheduler Log File Size

You can configure the log file size for capturing jobs, schedules, and job output.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal
	switch(config)#
					

Step 2

Define the scheduler log file size in kilobytes using the command scheduler logfile size value

Example:

switch(config)# scheduler logfile size 1024
					

The range is from 16 to 1024. The default is 16.

Note

 
If the size of the job output is greater than the size of the log file, then the output is truncated.

Step 3

Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
					

This is an optional step.


Configure Remote User Authentication

You can configure the scheduler to use remote authentication for users who want to configure and schedule jobs.


Note


Remote users must authenticate with their clear text password before creating and configuring jobs.

Note


Remote user passwords are always shown in encrypted form in the output of the show running-config command. The encrypted option ( 7 ) in the command supports the ASCII device configuration.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal
	switch(config)#
					

Step 2

Configure a cleartext password for the user who is currently logged in using the command scheduler aaa-authentication password [ 0 | 7 ] password

Example:

switch(config)# scheduler aaa-authentication password X12y34Z56a
					

Step 3

Configure a cleartext password for a remote user using the command scheduler aaa-authentication username name password [ 0 | 7 ] password

Example:

switch(config)# scheduler aaa-authentication username newuser password Z98y76X54b
					

Step 4

Display the scheduler password information using the command show running-config | include “scheduler aaa-authentication”

Example:

switch(config)# show running-config | include “scheduler aaa-authentication”
					

This is an optional step.

Step 5

Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
					

This is an optional step.


Define Job

You can define a job including the job name and the command sequence.


Caution


After you define a job, you cannot modify or remove commands. To change the job, you must delete it and create a new one.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal
	switch(config)#
					

Step 2

Create a job and enter the job configuration mode using the command scheduler job name string

Example:

switch(config)# scheduler job name backup-cfg
	switch(config-job)
					

This example creates a scheduler job named "backup-cfg".

Step 3

Define the sequence of commands for the specified job using the command command1 ;[ command2 ; command3 ;...]

Example:

switch(config-job)# copy running-config 
	tftp://1.2.3.4/$(SWITCHNAME)-cfg.$(TIMESTAMP) vrf management
	switch(config-job)#
					

Separate commands with spaces and semicolons (for example, “ ;”).

This example creates a scheduler job that saves the running configuration to a file in the bootflash. The job then copies the file from the bootflash to a TFTP server and creates the filename using the current timestamp and switch name.

Step 4

Display the job information using the command show scheduler job [ name name ]

Example:

switch(config-job)# show scheduler job
					
[/bookmap/topic/ct_task/ct_taskbody/steps/step/info/p {"B1_Body1-F9CE5028-IDTBL490---Cisco-purpose--"}) This is an optional step. (p]

Step 5

Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
					

This is an optional step.


Delete Job

You can delete a job from the scheduler.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal
	switch(config)#
					

Step 2

Delete the specified job and all commands defined within it using the command no scheduler job name string

Example:

switch(config)# no scheduler job name configsave
	switch(config-job)
					

Step 3

Display the job information using the command show scheduler job [ name name ]

Example:

switch(config-job)# show scheduler job name configsave
					

This is an optional step.

Step 4

Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
					

This is an optional step.


Define Timetable

You can define a timetable in the scheduler to be used with one or more jobs.

If you do not specify the time for the time commands, the scheduler assumes the current time. For example, if the current time is March 24, 2013, 22:00 hours, jobs are started as follows:

  • For the time start 23:00 repeat 4:00:00 command, the scheduler assumes a start time of March 24, 2013, 23:00 hours.

  • For the time daily 55 command, the scheduler assumes a start time every day at 22:55 hours.

  • For the time weekly 23:00 command, the scheduler assumes a start time every Friday at 23:00 hours.

  • For the time monthly 23:00 command, the scheduler assumes a start time on the 24th of every month at 23:00 hours.


Note


The scheduler will not begin the next occurrence of a job before the last one completes. For example, you have scheduled a job to be completed at one-minute intervals beginning at 22:00; but the job requires two minutes to complete. The scheduler starts the first job at 22:00, completes it at 22:02, and then observes a one-minute interval before starting the next job at 22:03.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal
	switch(config)#
					

Step 2

Create a new schedule and places you in schedule configuration mode for that schedule using the command scheduler schedule name string

Example:

switch(config)# scheduler schedule name weekendbackupqos
	switch(config-schedule)#
					

Step 3

Associate a job with this schedule using the command job name string

Example:

switch(config-schedule)# job name offpeakZoning
					

You can add multiple jobs to a schedule.

Step 4

Indicate the job starts every day at a designated time specified as HH:MM using the command time daily time

Example:

switch(config-schedule)# time daily 23:00
					

Step 5

Indicate that the job starts on a specified day of the week using the command time weekly [[ dow :] HH :] MM

Example:

switch(config-schedule)# time weekly Sun:23:00
					

Day of the week (dow) specified as one of the following:

  • An integer such as 1 = Sunday, 2 = Monday, and so on.

  • An abbreviation such as Sun = Sunday.

The maximum length for the entire argument is 10.

Step 6

Indicate the job starts on a specified day each month (dm) using the command time monthly [[ dm :] HH :] MM

Example:

switch(config-schedule)# time monthly 28:23:00
					

If you specify either 29, 30, or 31, the job is started on the last day of each month.

Step 7

Indicate the job starts periodically using the command time start { now repeat repeat-interval | delta-time [ repeat repeat-interval ]}

Example:

switch(config-schedule)# time start now repeat 48:00
					

The start-time format is [[[[yyyy:]mmm:]dd:]HH]:MM.

  • delta-time —Specifies the amount of time to wait after the schedule is configured before starting a job.

  • now —Specifies that the job starts now.

  • repeat repeat-interval —Specifies the frequency at which the job is repeated.

In this example, the job starts immediately and repeats every 48 hours.

Step 8

Display the scheduler configuration using the command show scheduler config

Example:

switch(config)# show scheduler config
					

This is an optional step.

Step 9

Copy the running configuration to the startup configuration using the command copy running-config startup-config

Example:

switch(config)# copy running-config startup-config
					

This is an optional step.


Clear Scheduler Log File

You can clear the scheduler log file.

Procedure


Step 1

Enter global configuration mode using the command configure terminal

Example:

switch# configure terminal
	switch(config)#
					

Step 2

Clear the scheduler log file using the command clear scheduler logfile

Example:

switch(config)# clear scheduler
	logfile
					

Verify Scheduler Configuration

To display the scheduler configuration information, perform one of the following tasks:

Command Purpose
show scheduler config Displays the scheduler configuration.
show scheduler job [ name string ] Displays the jobs configured.
show scheduler logfile Displays the contents of the scheduler log file.
show scheduler schedule [ name string ] Displays the schedules configured.

Configuration Examples

Display Job Schedule

This example shows how to display the job schedule:

switch# show scheduler schedule
Schedule Name : daily
---------------------------
User Name : admin
Schedule Type : Run every day at 1 Hrs 00 Mins
Last Execution Time : Fri Jan 2 1:00:00 2013
Last Completion Time: Fri Jan 2 1:00:01 2013
Execution count : 2
-----------------------------------------------
Job Name Last Execution Status
-----------------------------------------------
back-cfg Success (0)
switch#

Schedule a Scheduler Job

This example shows how to schedule a scheduler job called backup-cfg to run daily at 1 a.m.:

switch# configure terminal
switch(config)# scheduler schedule name daily
switch(config-if)# job name backup-cfg
switch(config-if)# time daily 1:00
switch(config-if)# end
switch(config)#

Create Scheduler Job

This example shows how to create a scheduler job that saves the running configuration to a file in the bootflash. The job then copies the file from the bootflash to a TFTP server (creates the filename using the current timestamp and switch name):

switch# configure terminal
switch(config)# scheduler job name backup-cfg
switch(config-job)# copy running-config 
tftp://1.2.3.4/$(SWITCHNAME)-cfg.$(TIMESTAMP) vrf management
switch(config-job)# end
switch(config)#

Display Results of Running Scheduler Jobs

This example shows how to display the results of scheduler jobs that have been executed by the scheduler:

switch# show scheduler logfile
Job Name : back-cfg Job Status: Failed (1)
Schedule Name : daily User Name : admin
Completion time: Fri Jan 1 1:00:01 2013
--------------------------------- Job Output ---------------------------------
`cli var name timestamp 2013-01-01-01.00.00`
`copy running-config bootflash:/$(HOSTNAME)-cfg.$(timestamp)`
`copy bootflash:/switch-cfg.2013-01-01-01.00.00 tftp://1.2.3.4/ vrf management `
copy: cannot access file '/bootflash/switch-cfg.2013-01-01-01.00.00'
==============================================================================
Job Name : back-cfg Job Status: Success (0)
Schedule Name : daily User Name : admin
Completion time: Fri Jan 2 1:00:01 2013
--------------------------------- Job Output ---------------------------------
`cli var name timestamp 2013-01-02-01.00.00`
`copy running-config bootflash:/switch-cfg.2013-01-02-01.00.00`
`copy bootflash:/switch-cfg.2013--01-02-01.00.00 tftp://1.2.3.4/ vrf management `
Connection to Server Established.
[ ] 0.50KBTrying to connect to tftp server......
[###### ] 24.50KB
TFTP put operation was successful
==============================================================================
switch#