#!/bin/bash help () { echo "Supernode Settings:" echo "status | off | on" } status () { supernode_status=$(/bin/cat /etc/supernode-status/supernode.status) supernode_mode=$(/bin/cat /etc/supernode-status/supernode.mode) echo -e "\nSupernode Status: (Ist-Zustand)" if [ $supernode_status == 0 ]; then echo "Supernode ist Abgeschaltet" elif [ $supernode_status == 1 ]; then echo "Supernode läuft (Automatik inkl. Backup)" elif [ $supernode_status == 2 ]; then echo "Supernode läuft (Backup Netz Aktiv)" elif [ $supernode_status == 3 ]; then echo "Supernode läuft (Backup deaktiviert)" fi echo -e "\nSupernode Status: (Soll-Zustand)" if [ $supernode_mode == 0 ]; then echo "Supernode ist Abgeschaltet" elif [ $supernode_mode == 1 ]; then echo "Supernode läuft (Automatik inkl. Backup)" elif [ $supernode_mode == 2 ]; then echo "Supernode läuft (Backup Netz Aktiv)" elif [ $supernode_mode == 3 ]; then echo "Supernode läuft (Backup deaktiviert)" fi echo -e "\nService Status" for service in bird bird6 dhcpd radvd python named do if [ "$(/bin/cat /etc/supernode-status/$service.status)" = "1" ]; then echo -e "$service läuft" else echo -e "$service aus" fi done } off () { echo 0 > /etc/supernode-status/supernode.mode /usr/sbin/service tunneldigger stop /usr/sbin/service bind9 stop /usr/sbin/service bird stop /usr/sbin/service bird6 stop /usr/sbin/service isc-dhcp-server stop /usr/sbin/service radvd stop /usr/local/sbin/batctl gw off echo "Supernode Aus" } on () { echo 1 > /etc/supernode-status/supernode.mode /usr/sbin/service tunneldigger restart /usr/sbin/service bind9 restart /usr/sbin/service bird restart /usr/sbin/service bird6 restart /usr/sbin/service isc-dhcp-server restart /usr/sbin/service radvd restart /usr/local/sbin/batctl gw server 100Mbit/100Mbit echo "Supernode An" } $1