26 lines
547 B
Bash
Executable file
26 lines
547 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ $# -ge 1 ]; then
|
|
cmd="$@"
|
|
else
|
|
cmd="hostname;uptime"
|
|
fi
|
|
|
|
for notebook in nb1 nb2 nb3 bridge line hike freiheit; do
|
|
found=""
|
|
|
|
echo "Looking for ${notebook}"
|
|
for place in place7 place10; do
|
|
if [ -z "$found" ]; then
|
|
fqdn=${notebook}.${place}.ungleich.ch
|
|
ping -c2 ${fqdn} >/dev/null && found=$place
|
|
fi
|
|
done
|
|
|
|
if [ "$found" ]; then
|
|
echo Found ${notebook} in ${found}
|
|
ssh nico@${fqdn} ${cmd}
|
|
else
|
|
echo "Did not reach ${notebook}"
|
|
fi
|
|
done
|