Update..
This commit is contained in:
52
roles/common/templates/root/bin/wakeup_lan.sh.j2
Executable file
52
roles/common/templates/root/bin/wakeup_lan.sh.j2
Executable file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# {{ ansible_managed }}
|
||||
|
||||
declare -i pc_nr=1
|
||||
pc_nr_max=10
|
||||
brcast_ip="192.168.82.255"
|
||||
|
||||
ab1="38:60:77:39:9e:9f"
|
||||
#ab2="38:60:77:39:9a:a3"
|
||||
ab3="00:22:15:aa:88:b9"
|
||||
ab4="00:22:4d:b0:f3:d6"
|
||||
ab5="80:ee:73:b9:8b:d3 80:ee:73:b9:8b:d4"
|
||||
ab6="80:ee:73:c0:80:22"
|
||||
ab7="80:ee:73:c5:2e:fb 80:ee:73:c5:2e:fc"
|
||||
ab8="80:ee:73:d0:a5:71 80:ee:73:d0:a5:72"
|
||||
ab9="80:ee:73:e0:0e:8a 80:ee:73:e0:0e:8b"
|
||||
ab10="00:d8:61:c9:c8:3d"
|
||||
|
||||
if [ $# = "1" ]; then
|
||||
echo ""
|
||||
echo -e " \033[32mWake up PC '$1'\033[m.."
|
||||
_nic=`eval eval echo '$'$1`
|
||||
if [[ -n "$_nic" ]]; then
|
||||
for _mac in $_nic ; do
|
||||
echo -n " "
|
||||
wakeonlan -i $brcast_ip $_mac
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
echo -e " \033[1;31mPC '$1' NOT found!\033[m"
|
||||
fi
|
||||
echo ""
|
||||
else
|
||||
while [[ $pc_nr -le $pc_nr_max ]]; do
|
||||
[[ -z "$pc_nr" ]] && continue
|
||||
_nic=$(eval eval echo '$ab'$pc_nr)
|
||||
if [[ -n "$_nic" ]]; then
|
||||
echo ""
|
||||
echo -e " \033[32mWake up PC 'ab$pc_nr'\033[m.."
|
||||
for _mac in $_nic ; do
|
||||
echo -n " "
|
||||
/usr/bin/wakeonlan -i $brcast_ip $_mac
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
(( pc_nr++ ))
|
||||
done
|
||||
echo ""
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user