bash scripts
This commit is contained in:
1 parent
7ed4fc67d5
commit
7db38ae9f4
25 files changed
+2375
No files matched your search
@@ -0,0 +1,21 @@
|
||||
#!/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
|
||||
ifx=( $(/sbin/ip -br l | awk '$1 !~ "lo|vir|wl" { print $1}') )
|
||||
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