Rebooting switch at the current day in the evening

  • 7 January 2014
  • 3 replies

Userlevel 4
Create Date: Jul 19 2013 11:22AM


I would like do write a script which reboots the switch at the current day in the evening.

For this I need the current month as integer and not as string.

Actually I am using the following script.

My question is: Is there a possibility to do it a little bit shorter?

# ------ snip ------

set var CLI.OUT " "
set var hour 21 # Die Boot-Zeit darf nicht am Folgetag sein
set var minute 5
set var second 0

show switch
set var year $TCL(lrange ${CLI.OUT} 31 31)
set var month $TCL(lrange ${CLI.OUT} 28 28)
set var day $TCL(lrange ${CLI.OUT} 29 29)

if ( [string equal $month Jan ] ) then
set var month 01
if ( [string equal $month Feb ] ) then
set var month 02
if ( [string equal $month Mar ] ) then
set var month 03
if ( [string equal $month Apr ] ) then
set var month 04
if ( [string equal $month May ] ) then
set var month 05
if ( [string equal $month Jun ] ) then
set var month 06
if ( [string equal $month Jul ] ) then
set var month 07
if ( [string equal $month Aug ] ) then
set var month 08
if ( [string equal $month Sep ] ) then
set var month 09
if ( [string equal $month Oct ] ) then
set var month 10
if ( [string equal $month Nov ] ) then
set var month 11
if ( [string equal $month Dec ] ) then
set var month 12

# show var year
# show var month
# show var day

reboot time $month $day $year $hour $minute $second

# ------ snip ------

(from Hans_Vedder)

3 replies

Userlevel 4
Create Date: Jul 19 2013 12:36PM


set "upm" at time do you need, example

create upm profile Copy
-- script here / reboot command--
create upm timer tCopy
configure upm timer tCopy profile Copy
configure upm timer tCopy at 7 4 2013 1 30 0 every 86400
enable upm profile Copy

Jarek (from Jaroslaw_Kasjaniuk)
Userlevel 4
Create Date: Jul 19 2013 12:50PM

Your UPM profile reboots the switch every day.

I want to write a script which loads a new firmeware and reboots the switch the same day in the evening. I don't need a daily reboot.

And if possible, I want only to change the new version of the firmeware in the script. (from Hans_Vedder)
Userlevel 4
Create Date: Nov 27 2013 2:39AM

Use "show log" command instead of "show switch" and grab the current date from the last event. In the log, the date format is yyyy-mm-dd so it is easy enough to get it.

That's the way to make it shorter. (from Eugen_NAIMAN)