Rebooting switch at the current day in the evening

  • 0
  • 1
  • Question
  • Updated 5 years ago
  • Answered
Create Date: Jul 19 2013 11:22AM

Hi,

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
endif
if ( [string equal $month Feb ] ) then
  set var month 02
endif
if ( [string equal $month Mar ] ) then
  set var month 03
endif
if ( [string equal $month Apr ] ) then
  set var month 04
endif
if ( [string equal $month May ] ) then
  set var month 05
endif
if ( [string equal $month Jun ] ) then
  set var month 06
endif
if ( [string equal $month Jul ] ) then
  set var month 07
endif
if ( [string equal $month Aug ] ) then
  set var month 08
endif
if ( [string equal $month Sep ] ) then
  set var month 09
endif
if ( [string equal $month Oct ] ) then
  set var month 10
endif
if ( [string equal $month Nov ] ) then
  set var month 11
endif
if ( [string equal $month Dec ] ) then
  set var month 12
endif

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

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

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

(from Hans_Vedder)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb

Posted 5 years ago

  • 0
  • 1
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Jul 19 2013 12:36PM

Hi,

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)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
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)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
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)

This conversation is no longer open for comments or replies.