nsbin/notebook.sh
2021-05-31 22:39:02 +02:00

26 lines
585 B
Bash
Executable file

#!/bin/sh
if [ $# -ge 1 ]; then
cmd="$@"
else
cmd="~/bin/sync-all-repos staticonly"
fi
for notebook in nb1 nb2 nb3 bridge line hike freiheit; do
found=""
printf "Looking for ${notebook} ... "
for place in place7 place10; do
if [ -z "$found" ]; then
fqdn=${notebook}.${place}.ungleich.ch
ping -c2 ${fqdn} >/dev/null 2>&1 && found=$place
fi
done
if [ "$found" ]; then
echo found ${notebook} in ${found}: ${fqdn}
ssh nico@${fqdn} ${cmd}
else
echo "did not reach ${notebook}."
fi
done