Hallo, ich habe ein Problem mit meinem bash script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #!/bin/bash read -p "Server Hochfahren oder Herunterfahren?" A #Hochfahren oder Herunterfahren if [ "$A" == "Ho" ];then echo "Server wird Hochgefahren" python wake.py 192.168.2.255 3c:7c:3f:81:cd:07 elif [ "$A" == "He" ];then echo "Server wird Heruntergefahren" ssh root@192.168.2.132 'ethtool -s enp4s0 wol g && shutdown -h now' if [ "$A" == "ho" ];then echo "Server wird Hochgefahren" python wake.py 192.168.2.255 3c:7c:3f:81:cd:07 elif [ "$A" == "he" ];then echo "Server wird Heruntergefahren" ssh root@192.168.2.132 'ethtool -s enp4s0 wol g && shutdown -h now' #shell elif [ "$A" == "s" ];then exit elif [ "$A" == "shell" ];then exit elif [ "$A" == "c" ];then exit #schließen elif [ "$A" == "e" ];then kill -HUP $PPID elif [ "$A" == "q" ];then kill -HUP $PPID elif [ "$A" == "exit" ];then kill -HUP $PPID elif [ "$A" == "quit" ];then kill -HUP $PPID elif [ "$A" == "quiet" ];then kill -HUP $PPID else clear echo "Detect failed(only Ho or He)" ./server.sh fi |
Das script heißt server.sh. Jedoch wenn ich das script ausführe kommt dieser Error:
1 2 3 4 | root@Wol:/# ./server.sh Server Hochfahren oder Herunterfahren?He ./server.sh: Zeile 46: Syntax Fehler: Unerwartetes Dateiende. root@Wol:/# |
Vielleicht kann mir jemand helfen? Grüße