Add script to do things on my notebook
This commit is contained in:
parent
c89935f641
commit
ffc507204b
1 changed files with 26 additions and 0 deletions
26
notebook.sh
Executable file
26
notebook.sh
Executable 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
|
Loading…
Reference in a new issue