nsbin/notebook.sh

27 lines
585 B
Bash
Raw Normal View History

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