move wol script
This commit is contained in:
1 parent
58baa5f011
commit
d1887382f2
1 file changed
+2
-1
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
device=$1
|
||||
if [ "$device" == "serverhost" ]; then
|
||||
mac="64:51:06:51:cb:39"
|
||||
elif [ "$device" == "quiethost" ]; then
|
||||
mac="24:4B:FE:DE:93:3E"
|
||||
elif [ "$(echo ${device} | grep -E -o "([0-9A-Fa-f]{2}[\:]){5}[0-9A-Fa-f]{2}")" != "" ]; then
|
||||
mac="${device}"
|
||||
else
|
||||
printf "Nonsense Input, hostname needed\n"
|
||||
exit 0
|
||||
fi
|
||||
mapfile -t ifx < <(ip -o link show | awk -F': ' '{print $2}')
|
||||
echo ${ifx[@]}
|
||||
for i in ${!ifx[@]}; do
|
||||
sudo /usr/sbin/etherwake -b -i ${ifx[$i]} $mac
|
||||
printf "%shost succsefully woken via ${ifx[$i]}: ${mac}\n" "$device"
|
||||
done
|
||||
if [ "$(echo $SSH_CONNECTION | cut -f1 -d' ')" == "10.0.0.26" ]; then
|
||||
ssh quiethost notify-send "Woke ${device}"
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user