Benutzer-Werkzeuge

Webseiten-Werkzeuge


user:sprobst:blog:ubiquiti_unifi_switch_-_scripting

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

user:sprobst:blog:ubiquiti_unifi_switch_-_scripting [2022/04/15 19:26]
SProbst angelegt
user:sprobst:blog:ubiquiti_unifi_switch_-_scripting [2022/11/27 19:15] (aktuell)
SProbst
Zeile 14: Zeile 14:
 # Stephan Klein # Stephan Klein
 # Dipl.-Inform. (FH) # Dipl.-Inform. (FH)
 +#
 +# 24v Option hinzugefügt -> Steffen Probst
  
 function usage { function usage {
         echo         echo
-        echo $"​Usage:​ $0  <​on|off>​ "+        echo $"​Usage:​ $0  <on|24V|off> "
         echo         echo
         echo "​Example:​ $0 192.168.178.12 on 8"         echo "​Example:​ $0 192.168.178.12 on 8"
Zeile 32: Zeile 34:
  
 function valid_action { function valid_action {
-        [[ "​${1,,​}"​ =~ ^on|off$ ]] && return 0 || return 1+        [[ "​${1,,​}"​ =~ ^on|24v|off$ ]] && return 0 || return 1
 } }
  
Zeile 60: Zeile 62:
  
 cmd_on="​interface 0/$3\npoe opmode auto\nexit"​ cmd_on="​interface 0/$3\npoe opmode auto\nexit"​
 +cmd_24v="​interface 0/$3\npoe opmode passive24v\nexit"​
 cmd_off="​interface 0/$3\npoe opmode shutdown\nexit"​ cmd_off="​interface 0/$3\npoe opmode shutdown\nexit"​
 cmd_status="​show poe status 0/$3" cmd_status="​show poe status 0/$3"
Zeile 68: Zeile 71:
         on)         on)
                 ssh admin@$1 '(echo "​enable"​ ; echo "​configure"​ ; echo "​interface 0/'​$3'"​ ; echo "poe opmode auto" ; echo "​exit"​ ; echo "​exit";​ echo "​exit" ​ ) | telnet localhost 23 ; exit;'                 ssh admin@$1 '(echo "​enable"​ ; echo "​configure"​ ; echo "​interface 0/'​$3'"​ ; echo "poe opmode auto" ; echo "​exit"​ ; echo "​exit";​ echo "​exit" ​ ) | telnet localhost 23 ; exit;'
 +                ;;
 +        24v)
 +                ssh admin@$1 '(echo "​enable"​ ; echo "​configure"​ ; echo "​interface 0/'​$3'"​ ; echo "poe opmode passive24v"​ ; echo "​exit"​ ; echo "​exit";​ echo "​exit" ​ ) | telnet localhost 23 ; exit;'
                 ;;                 ;;
         off)         off)
user/sprobst/blog/ubiquiti_unifi_switch_-_scripting.txt · Zuletzt geändert: 2022/11/27 19:15 von SProbst