assign raw socket access to etherwake

This commit is contained in:
Lucas Vivo committed 2026-10-16 17:44:44 +02:00
1 parent 2eb7b8d6d1
commit d1e2f8a3e5
1 file changed
+6 -1
+6 -1
View File
@@ -12,6 +12,11 @@ else
printf "Nonsense Input, hostname needed\n" printf "Nonsense Input, hostname needed\n"
exit 0 exit 0
fi 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 < <( mapfile -t ifx < <(
ip -o link show | ip -o link show |
awk -F': ' '{print $2}' | 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[@]} echo ${ifx[@]}
for i in ${!ifx[@]}; do 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" printf "%shost succsefully woken via ${ifx[$i]}: ${mac}\n" "$device"
done done
if [ "$(echo $SSH_CONNECTION | cut -f1 -d' ')" == "10.0.0.26" ]; then if [ "$(echo $SSH_CONNECTION | cut -f1 -d' ')" == "10.0.0.26" ]; then