Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Configuring a Schedule for Executing the Commands or Scripts (SRC CLI)

 

To periodically execute the SRC CLI commands or scripts according to a given schedule, use the system schedule schedule-name command. You can use the redirection operator (>) with the commands or scripts to redirect the command execution output to a file.

Use the following statements to schedule a repetitive task on an SRC system:

To periodically execute the commands or scripts according to a given schedule:

  1. In configuration mode, enter the name of the schedule that is capable of adding schedule entries for the executable scripts or commands. A schedule name can contain alphanumeric characters only. In this sample procedure, src1cron is the name of the schedule.
  2. (Optional) Enter the day of the week on which you want the command or script sequence to execute. The default value is * (asterisk).
  3. (Optional) Enter the month of the year in which you want the command or script sequence to execute. The default value is * (asterisk).
  4. (Optional) Enter the day of the month on which you want the command or script sequence to execute. The default value is * (asterisk).
  5. (Optional) Enter the hour of the day at which you want the command or script sequence to execute. The default value is * (asterisk).
  6. (Optional) Enter the minute at which you want the command or script sequence to execute. The default value is * (asterisk).

    Table 8 lists the values allowed for the periodic strings (such as day-of-week, month, day-of-month, hour, and minute).

    Table 8: Values Allowed for the Periodic Strings

    Options

    Values

    day-of-week

    0–7 (where both 0 and 7 mean Sunday) or SUN-SAT

    month

    1–12 or JAN-DEC

    day-of-month

    1–31

    hour

    0–23

    minute

    0–59

    You can use multiple combinations of the special characters described in Table 9.

    Table 9: Available Special Characters

    Special Characters

    Meaning

    *

    Indicates all values.

    For example, to execute the command or script every hour:

    user@host# set hour *

    /

    Indicates the increments of ranges.

    For example, to execute the command or script at the third minute of the hour and every 15 minutes thereafter:

    user@host# set minute 3-59/15

    ,

    Indicates to separate the values of a list.

    For example, to execute the command or script on Mondays, Wednesdays and Fridays:

    user@host# day of week MON,WED,FRI

    -

    Indicates the ranges.

    For example, to execute the command or script every hour from 3 through 10:

    user@host# set hour 3-10

  7. (Optional) Enter the special string values such as reboot, yearly, annually, monthly, weekly, daily, midnight, and hourly at which you want the command or script sequence to execute.

    For example, to execute the command or script at midnight on the first day of each month:

    Note

    If you configure both special string values and periodic string values (such as day-of-week, month, day-of-month, hour, or minute options), a message indicating that both special strings and periodic strings cannot be defined is displayed when you commit the changes.

    Table 10 lists the special string options.

    Table 10: Special String Options

    Options

    Description

    reboot

    Executes the command or script at boot and reboot of the system.

    yearly

    Executes the command or script at midnight, January 1 each year.

    annually

    Executes the command or script at midnight, January 1 each year.

    monthly

    Executes the command or script at midnight on the first day of each month.

    weekly

    Executes the command or script at midnight each Sunday.

    daily

    Executes the command or script at midnight each day.

    midnight

    Executes the command or script at midnight each day.

    hourly

    Executes the command or script at on the first second of every hour.

  8. Configure the complete path of the script to be executed for the schedule. Note

    The script and command options are mutually exclusive. You cannot configure both options at the same time.

    Note

    The CLI editing level must be set to expert by using the set cli level expert command for this option.

  9. Configure the CLI command to be executed for the schedule.Note
    • The script and command options are mutually exclusive. You cannot configure both options at the same time.

    Before you configure a CLI command for the schedule, perform the following steps to make sure that you can configure the CLI command as part of the schedule execution:

    1. Enter the CLI command in the shell with the cli –c “command name” option.

    2. Verify whether the CLI command returns the expected output.

  10. (Optional) Verify your configuration.