06-定时执行任务典型配置举例
本章节下载: 06-定时执行任务典型配置举例 (100.59 KB)
目 录
本章介绍了通过配置定时执行任务功能让设备在指定时间,自动执行指定命令,使设备能够在无人值守的情况下完成某些配置。该功能不但增强了设备的自动控制和管理能力,提高了易用性,而且可以起到有效节能的作用。
产品 |
软件版本 |
S5830V2&S5820V2系列以太网交换机 |
Release 2208P01,Release 2210 |
某公司组网如图1所示,现要求在Device上配置定时执行任务,使得端口Ten-GigabitEthernet1/0/1与Ten-GigabitEthernet1/0/2在工作日的08:00~18:00开启,其它时间段关闭,以起到有效节能的作用。
# 进入系统视图。
<Sysname> system-view
# 创建关闭Ten-GigabitEthernet1/0/1的Job。
[Sysname] scheduler job shutdown-ten-gigabitethernet1/0/1
[Sysname-job-shutdown-ten-gigabitethernet1/0/1] command 1 system-view
[Sysname-job-shutdown-ten-gigabitethernet1/0/1] command 2 interface ten-gigabitethernet 1/0/1
[Sysname-job-shutdown-ten-gigabitethernet1/0/1] command 3 shutdown
[Sysname-job-shutdown-ten-gigabitethernet1/0/1] quit
# 创建开启Ten-GigabitEthernet1/0/1的Job。
[Sysname] scheduler job start-ten-gigabitethernet1/0/1
[Sysname-job-start-ten-gigabitethernet1/0/1] command 1 system-view
[Sysname-job-start-ten-gigabitethernet1/0/1] command 2 interface ten-gigabitethernet 1/0/1
[Sysname-job-start-ten-gigabitethernet1/0/1] command 3 undo shutdown
[Sysname-job-start-ten-gigabitethernet1/0/1] quit
# 创建关闭Ten-GigabitEthernet1/0/2的Job。
[Sysname] scheduler job shutdown-ten-gigabitethernet1/0/2
[Sysname-job-shutdown-ten-gigabitethernet1/0/2] command 1 system-view
[Sysname-job-shutdown-ten-gigabitethernet1/0/2] command 2 interface ten-gigabitethernet 1/0/2
[Sysname-job-shutdown-ten-gigabitethernet1/0/2] command 3 shutdown
[Sysname-job-shutdown-ten-gigabitethernet1/0/2] quit
# 创建开启Ten-GigabitEthernet1/0/2的Job。
[Sysname] scheduler job start-ten-gigabitethernet1/0/2
[Sysname-job-start-ten-gigabitethernet1/0/2] command 1 system-view
[Sysname-job-start-ten-gigabitethernet1/0/2] command 2 interface ten-gigabitethernet 1/0/2
[Sysname-job-start-ten-gigabitethernet1/0/2] command 3 undo shutdown
[Sysname-job-start-ten-gigabitethernet1/0/2] quit
# 配置定时执行任务,使Device在星期一到星期五的上午八点开启PC1、PC2对应的以太网端口。
[Sysname] scheduler schedule START-PC1/PC2
[Sysname-schedule-START-PC1/PC2] job start-ten-gigabitethernet1/0/1
[Sysname-schedule-START-PC1/PC2] job start-ten-gigabitethernet1/0/2
[Sysname-schedule-START-PC1/PC2] time repeating at 8:00 week-day mon tue wed thu fri
[Sysname-schedule-START-PC1/PC2] quit
# 配置定时执行任务,使Device在星期一到星期五的下午十八点关闭PC1、PC2对应的以太网端口。
[Sysname] scheduler schedule STOP-PC1/PC2
[Sysname-schedule-STOP-PC1/PC2] job shutdown-ten-gigabitethernet1/0/1
[Sysname-schedule-STOP-PC1/PC2] job shutdown-ten-gigabitethernet1/0/2
[Sysname-schedule-STOP-PC1/PC2] time repeating at 18:00 week-day mon tue wed thu fri
[Sysname-schedule-STOP-PC1/PC2] quit
# 显示Job的配置信息。
[Sysname] display scheduler job
Job name: shutdown-ten-gigabitethernet1/0/1
system-view
interface ten-gigabitethernet1/0/1
shutdown
Job name: shutdown-ten-gigabitethernet1/0/2
system-view
interface ten-gigabitethernet1/0/2
shutdown
Job name: start-ten-gigabitethernet1/0/1
system-view
interface ten-gigabitethernet1/0/1
undo shutdown
Job name: start-ten-gigabitethernet1/0/2
system-view
interface ten-gigabitethernet1/0/2
undo shutdown
# 显示定时任务的运行信息。
[Sysname] display scheduler schedule
Schedule name : START-PC1/PC2
Schedule type : Run on every Mon Tue Wed Thu Fri at 08:00:00
Start time : Wed Sep 25 08:00:00 2013
Last execution time : Wed Sep 25 08:00:00 2013
Last completion time : Wed Sep 25 08:00:03 2013
Execution counts : 1
-----------------------------------------------------------------------
Job name Last execution status
start-ten-gigabitethernet1/0/1 Successful
start-ten-gigabitethernet1/0/2 Successful
Schedule name : STOP-PC1/PC2
Schedule type : Run on every Mon Tue Wed Thu Fri at 18:00:00
Start time : Wed Sep 25 18:00:00 2013
Last execution time : Wed Sep 25 18:00:00 2013
Last completion time : Wed Sep 25 18:00:01 2013
Execution counts : 1
-----------------------------------------------------------------------
Job name Last execution status
shutdown-ten-gigabitethernet1/0/1 Successful
shutdown-ten-gigabitethernet1/0/2 Successful
# 显示Job运行的输出信息。
[Sysname] display scheduler logfile
Logfile Size: 1440 Bytes.
Job name : start-ten-gigabitethernet1/0/1
Schedule name : START-PC1/PC2
Execution time : Wed Sep 25 08:00:00 2013
Completion time : Wed Sep 25 08:00:02 2013
--------------------------------- Job output -----------------------------------
<Sysname>system-view
System View: return to User View with Ctrl+Z.
[Sysname]interface ten-gigabitethernet 1/0/1
[Sysname-Ten-GigabitEthernet1/0/1]undo shutdown
Job name : start-ten-gigabitethernet1/0/2
Schedule name : START-PC1/PC2
Execution time : Wed Sep 28 08:00:00 2011
Completion time : Wed Sep 28 08:00:02 2011
--------------------------------- Job output -----------------------------------
<Sysname>system-view
System View: return to User View with Ctrl+Z.
[Sysname]interface ten-gigabitethernet 1/0/2
[Sysname-Ten-GigabitEthernet1/0/2]undo shutdown
Job name : shutdown-ten-gigabitethernet1/0/1
Schedule name : STOP-PC1/PC2
Execution time : Wed Sep 25 18:00:00 2013
Completion time : Wed Sep 25 18:00:01 2013
--------------------------------- Job output -----------------------------------
<Sysname>system-view
System View: return to User View with Ctrl+Z.
[Sysname]interface ten-gigabitethernet 1/0/1
[Sysname-Ten-GigabitEthernet1/0/1]shutdown
Job name : shutdown-ten-gigabitethernet1/0/2
Schedule name : STOP-PC1/PC2
Execution time : Wed Sep 28 18:00:00 2011
Completion time : Wed Sep 28 18:00:01 2011
--------------------------------- Job output -----------------------------------
<Sysname>system-view
System View: return to User View with Ctrl+Z.
[Sysname]interface ten-gigabitethernet 1/0/2
[Sysname-Ten-GigabitEthernet1/0/2]shutdown
#
scheduler job shutdown-ten-gigabitethernet1/0/1
command 1 system-view
command 2 interface ten-gigabitethernet 1/0/1
command 3 shutdown
#
scheduler job shutdown-ten-gigabitethernet1/0/2
command 1 system-view
command 2 interface ten-gigabitethernet 1/0/2
command 3 shutdown
#
scheduler job start-ten-gigabitethernet1/0/1
command 1 system-view
command 2 interface ten-gigabitethernet 1/0/1
command 3 undo shutdown
#
scheduler job start-ten-gigabitethernet1/0/2
command 1 system-view
command 2 inter ten-gigabitethernet 1/0/2
command 3 undo shutdown
#
scheduler schedule START-PC1/PC2
job start-ten-gigabitethernet1/0/1
job start-ten-gigabitethernet1/0/2
time repeating at 08:00 week-day Mon Tue Wed Thu Fri
#
scheduler schedule STOP-PC1/PC2
job shutdown-ten-gigabitethernet1/0/1
job shutdown-ten-gigabitethernet1/0/2
time repeating at 18:00 week-day Mon Tue Wed Thu Fri
#
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!