assign raw socket access to etherwake
This commit is contained in:
1 parent
2eb7b8d6d1
commit
d1e2f8a3e5
1 file changed
+6
-1
+6
-1
@@ -12,6 +12,11 @@ else
|
||||
printf "Nonsense Input, hostname needed\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$(getcap /usr/sbin/etherwake)" != "/usr/sbin/etherwake cap_net_raw=ep" ]]; then
|
||||
echo "Assign raw socket access to etherwake"
|
||||
sudo setcap cap_net_raw+ep /usr/sbin/etherwake
|
||||
fi
|
||||
mapfile -t ifx < <(
|
||||
ip -o link show |
|
||||
awk -F': ' '{print $2}' |
|
||||
@@ -19,7 +24,7 @@ grep -E '^(eth[0-9]+|en[a-z0-9]+|wlan[0-9]+|wl[a-z0-9]+)$'
|
||||
)
|
||||
echo ${ifx[@]}
|
||||
for i in ${!ifx[@]}; do
|
||||
sudo /usr/sbin/etherwake -b -i ${ifx[$i]} $mac
|
||||
/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
|
||||
|
||||
Reference in new issue
Block a user