Created
March 2, 2014 14:50
-
-
Save pellekrogholt/9307657 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mac=$1 | |
kill_list_of_pids() { | |
pids=$1 | |
# lets kill them - had to use hard `kill -9` to get it working | |
# and remember to send to background otherwise only first item is killed | |
for pid in $pids; do | |
kill -9 $pid > /dev/null 2> /dev/null & | |
done | |
} | |
kill_all_process_by_mac(){ | |
# create at list of pids filter of the ones created by grep: | |
kill_list_of_pids $pids | |
} | |
kill_pingflood_device() { | |
pids=$(ps | grep "pingflood-*" | grep $mac | grep -v -F 'grep' | awk '{print $1}') | |
kill_list_of_pids $pids | |
} | |
./logger_bash kill_pids_by_mac "by mac: $mac" debug & | |
kill_pingflood_device | |
kill_all_process_by_mac | |
# not all are killed why ? | |
# because the "ash" bash version used by open-wrt do not support arrays! | |
# https://forum.openwrt.org/viewtopic.php?id=10824 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nb works in bash but not ash because the later one don't have arrays