cancel
Showing results for 
Search instead for 
Did you mean: 

Rebooting switch at the current day in the evening

Rebooting switch at the current day in the evening

EtherNation_Use
Contributor II
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)
3 REPLIES 3

EtherNation_Use
Contributor II
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)

EtherNation_Use
Contributor II
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)

EtherNation_Use
Contributor II
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)
GTM-P2G8KFN