#!/bin/bash if [ "$1" != "eg" ] && [ "$1" != "ikt" ] &&[ "$1" != "aula" ] &&[ "$1" != "ug" ] &&[ "$1" != "klabu" ]; then echo "eg / ikt / aula / ug / klabu" exit fi clients=`awk '/'$1'/ {print $2}' /etc/dhcpd.conf` if [ "$1" == "ikt" ]; then MUSTERRECHNER="192.168.100.130" elif [ "$1" == "klabu" ]; then MUSTERRECHNER="192.168.100.86" elif [ "$1" == "aula" ]; then MUSTERRECHNER="192.168.100.74" elif [ "$1" == "eg" ]; then MUSTERRECHNER="192.168.100.60" elif [ "$1" == "ug" ]; then MUSTERRECHNER="192.168.100.109" fi for client in $clients; do echo $client IP=`awk '/'$client'/ {print $8}' /etc/dhcpd.conf | tr -d ";"` # if [ "$IP" != "$MUSTERRECHNER" ]; then /usr/bin/expect -c " spawn /usr/bin/ssh -q -l root $IP \" poweroff; exit \" ;\ expect \"word: \" {send \"PASSWORT\r\" } ;\ interact " # fi done