Add script to do things on my notebook

This commit is contained in:
Nico Schottelius 2021-05-02 13:17:22 +02:00
parent c89935f641
commit ffc507204b

26
notebook.sh Executable file
View file

@ -0,0 +1,26 @@
#!/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