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)