Difference between revisions of "NOC:ctwug run"

From CTWUG Wiki
Jump to: navigation, search
(New page: == Purpose == == Dependencies == == Script == == WMS == Wug Management System)
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
== Purpose ==
 
== Purpose ==
 +
* Enables/Disables game time queues and firewall rules
 +
* Saves is_gametime.txt file
  
 
== Dependencies ==
 
== Dependencies ==
 +
host: noc.ctwug.za.net
 +
path: web/api/gametime
  
 
== Script ==
 
== Script ==
 
+
#:if ( [/file find name=is_gametime.txt] != "" ) do=[/file remove is_gametime.txt]
== WMS ==
+
/tool fetch host=noc.ctwug.za.net address=noc.ctwug.za.net src-path=web/api/gametime dst-path=is_gametime.txt mode=http
[[Wug Management System]]
+
:delay 1
 +
:local temp [/file get is_gametime.txt contents]
 +
:local fdisabled no
 +
:if ($temp = 0) do={:set fdisabled yes}
 +
 +
/queue simple
 +
:local qos
 +
:foreach qos in [find disabled!=$fdisabled] do={
 +
  :if ( [:pick [get $qos comment] 0 4] = "AUTO" ) do=[set $qos disabled=$fdisabled]
 +
}
 +
 +
/interface
 +
:local iface
 +
:foreach iface in [find disabled=no] do={
 +
  :if ( [:pick [get $iface comment] 0 4] = "qos;" ) do=[ :set fdisabled no]
 +
}
 +
 +
/ip firewall mangle
 +
:local fw
 +
:foreach fw in [find disabled!=$fdisabled] do={
 +
  :if ( [:pick [get $fw comment] 0 4] = "AUTO" ) do=[set $fw disabled=$fdisabled]
 +
}

Latest revision as of 18:09, 30 June 2013

Purpose

  • Enables/Disables game time queues and firewall rules
  • Saves is_gametime.txt file

Dependencies

host: noc.ctwug.za.net path: web/api/gametime

Script

#:if ( [/file find name=is_gametime.txt] != "" ) do=[/file remove is_gametime.txt]
/tool fetch host=noc.ctwug.za.net address=noc.ctwug.za.net src-path=web/api/gametime dst-path=is_gametime.txt mode=http
:delay 1
:local temp [/file get is_gametime.txt contents]
:local fdisabled no
:if ($temp = 0) do={:set fdisabled yes} 

/queue simple
:local qos
:foreach qos in [find disabled!=$fdisabled] do={
 :if ( [:pick [get $qos comment] 0 4] = "AUTO" ) do=[set $qos disabled=$fdisabled]
}

/interface
:local iface
:foreach iface in [find disabled=no] do={
 :if ( [:pick [get $iface comment] 0 4] = "qos;" ) do=[ :set fdisabled no]
}

/ip firewall mangle
:local fw
:foreach fw in [find disabled!=$fdisabled] do={
 :if ( [:pick [get $fw comment] 0 4] = "AUTO" ) do=[set $fw disabled=$fdisabled]
}