<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Rebooting switch at the current day in the evening in Scripting</title>
    <link>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19378#M66</link>
    <description>Create Date: Jul 19 2013 11:22AM&lt;BR /&gt;
&lt;BR /&gt;
Hi,&lt;BR /&gt;
&lt;BR /&gt;
I would like do write a script which reboots the switch at the current day in the evening.&lt;BR /&gt;
&lt;BR /&gt;
For this I need the current month as integer and not as string.&lt;BR /&gt;
&lt;BR /&gt;
Actually I am using the following script.&lt;BR /&gt;
&lt;BR /&gt;
My question is: Is there a possibility to do it a little bit shorter?&lt;BR /&gt;
&lt;BR /&gt;
# ------ snip ------&lt;BR /&gt;
&lt;BR /&gt;
set var CLI.OUT " "&lt;BR /&gt;
set var hour 21 # Die Boot-Zeit darf nicht am Folgetag sein&lt;BR /&gt;
set var minute 5&lt;BR /&gt;
set var second 0&lt;BR /&gt;
&lt;BR /&gt;
show switch&lt;BR /&gt;
set var year    $TCL(lrange ${CLI.OUT} 31 31)&lt;BR /&gt;
set var month $TCL(lrange ${CLI.OUT} 28 28)&lt;BR /&gt;
set var day     $TCL(lrange ${CLI.OUT} 29 29)&lt;BR /&gt;
&lt;BR /&gt;
if ( [string equal $month Jan ] ) then&lt;BR /&gt;
  set var month 01&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Feb ] ) then&lt;BR /&gt;
  set var month 02&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Mar ] ) then&lt;BR /&gt;
  set var month 03&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Apr ] ) then&lt;BR /&gt;
  set var month 04&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month May ] ) then&lt;BR /&gt;
  set var month 05&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Jun ] ) then&lt;BR /&gt;
  set var month 06&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Jul ] ) then&lt;BR /&gt;
  set var month 07&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Aug ] ) then&lt;BR /&gt;
  set var month 08&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Sep ] ) then&lt;BR /&gt;
  set var month 09&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Oct ] ) then&lt;BR /&gt;
  set var month 10&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Nov ] ) then&lt;BR /&gt;
  set var month 11&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Dec ] ) then&lt;BR /&gt;
  set var month 12&lt;BR /&gt;
endif&lt;BR /&gt;
&lt;BR /&gt;
# show var year&lt;BR /&gt;
# show var month&lt;BR /&gt;
# show var day&lt;BR /&gt;
&lt;BR /&gt;
reboot time $month $day $year $hour $minute $second&lt;BR /&gt;
&lt;BR /&gt;
# ------ snip ------&lt;BR /&gt;
&lt;BR /&gt;
  (from Hans_Vedder)</description>
    <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
    <dc:creator>EtherNation_Use</dc:creator>
    <dc:date>2014-01-08T05:50:00Z</dc:date>
    <item>
      <title>Rebooting switch at the current day in the evening</title>
      <link>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19378#M66</link>
      <description>Create Date: Jul 19 2013 11:22AM&lt;BR /&gt;
&lt;BR /&gt;
Hi,&lt;BR /&gt;
&lt;BR /&gt;
I would like do write a script which reboots the switch at the current day in the evening.&lt;BR /&gt;
&lt;BR /&gt;
For this I need the current month as integer and not as string.&lt;BR /&gt;
&lt;BR /&gt;
Actually I am using the following script.&lt;BR /&gt;
&lt;BR /&gt;
My question is: Is there a possibility to do it a little bit shorter?&lt;BR /&gt;
&lt;BR /&gt;
# ------ snip ------&lt;BR /&gt;
&lt;BR /&gt;
set var CLI.OUT " "&lt;BR /&gt;
set var hour 21 # Die Boot-Zeit darf nicht am Folgetag sein&lt;BR /&gt;
set var minute 5&lt;BR /&gt;
set var second 0&lt;BR /&gt;
&lt;BR /&gt;
show switch&lt;BR /&gt;
set var year    $TCL(lrange ${CLI.OUT} 31 31)&lt;BR /&gt;
set var month $TCL(lrange ${CLI.OUT} 28 28)&lt;BR /&gt;
set var day     $TCL(lrange ${CLI.OUT} 29 29)&lt;BR /&gt;
&lt;BR /&gt;
if ( [string equal $month Jan ] ) then&lt;BR /&gt;
  set var month 01&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Feb ] ) then&lt;BR /&gt;
  set var month 02&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Mar ] ) then&lt;BR /&gt;
  set var month 03&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Apr ] ) then&lt;BR /&gt;
  set var month 04&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month May ] ) then&lt;BR /&gt;
  set var month 05&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Jun ] ) then&lt;BR /&gt;
  set var month 06&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Jul ] ) then&lt;BR /&gt;
  set var month 07&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Aug ] ) then&lt;BR /&gt;
  set var month 08&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Sep ] ) then&lt;BR /&gt;
  set var month 09&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Oct ] ) then&lt;BR /&gt;
  set var month 10&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Nov ] ) then&lt;BR /&gt;
  set var month 11&lt;BR /&gt;
endif&lt;BR /&gt;
if ( [string equal $month Dec ] ) then&lt;BR /&gt;
  set var month 12&lt;BR /&gt;
endif&lt;BR /&gt;
&lt;BR /&gt;
# show var year&lt;BR /&gt;
# show var month&lt;BR /&gt;
# show var day&lt;BR /&gt;
&lt;BR /&gt;
reboot time $month $day $year $hour $minute $second&lt;BR /&gt;
&lt;BR /&gt;
# ------ snip ------&lt;BR /&gt;
&lt;BR /&gt;
  (from Hans_Vedder)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19378#M66</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Rebooting switch at the current day in the evening</title>
      <link>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19379#M67</link>
      <description>Create Date: Jul 19 2013 12:36PM&lt;BR /&gt;
&lt;BR /&gt;
Hi, &lt;BR /&gt;
&lt;BR /&gt;
set "upm" at  time do you need, example &lt;BR /&gt;
&lt;BR /&gt;
create upm profile Copy &lt;BR /&gt;
-- script here / reboot command-- &lt;BR /&gt;
. &lt;BR /&gt;
create upm timer tCopy &lt;BR /&gt;
configure upm timer tCopy profile Copy &lt;BR /&gt;
configure upm timer tCopy at 7 4 2013 1 30 0 every 86400 &lt;BR /&gt;
enable upm profile Copy&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Jarek  (from Jaroslaw_Kasjaniuk)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19379#M67</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Rebooting switch at the current day in the evening</title>
      <link>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19380#M68</link>
      <description>Create Date: Jul 19 2013 12:50PM&lt;BR /&gt;
&lt;BR /&gt;
Your UPM profile reboots the switch every day.&lt;BR /&gt;
&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
And if possible, I want only to change the new version of the firmeware in the script.  (from Hans_Vedder)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19380#M68</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
    <item>
      <title>RE: Rebooting switch at the current day in the evening</title>
      <link>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19381#M69</link>
      <description>Create Date: Nov 27 2013  2:39AM&lt;BR /&gt;
&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
That's the way to make it shorter.  (from Eugen_NAIMAN)</description>
      <pubDate>Wed, 08 Jan 2014 05:50:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/scripting/rebooting-switch-at-the-current-day-in-the-evening/m-p/19381#M69</guid>
      <dc:creator>EtherNation_Use</dc:creator>
      <dc:date>2014-01-08T05:50:00Z</dc:date>
    </item>
  </channel>
</rss>

