Last active
May 2, 2018 19:09
-
-
Save sbussetti/f3e9c729d25f3f225e9e9e168c2e3957 to your computer and use it in GitHub Desktop.
shieldsmasher
This file contains 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
#!/usr/bin/env bash | |
MAX_PROCS=${1:-10}; | |
ispinner () { | |
i=1 | |
sp="/-\|" | |
while true; do | |
echo -en "\033[0;0f" | |
printf "\b${sp:i++%${#sp}:1}" | |
sleep 1 | |
done; | |
} | |
clear | |
tput civis | |
function finish { | |
clear | |
echo "Exited..." | |
tput cnorm | |
exit 0; | |
} | |
trap finish INT TERM EXIT | |
ispinner & | |
while true; do | |
NUM_VS=$(ps auxwww | grep -i [V]ShieldScanner | wc -l | xargs); | |
echo -ne "\033[0;2f Number of [V]ShieldScanners: $NUM_VS \033[0K\r"; | |
if [ $NUM_VS -gt $MAX_PROCS ]; then | |
echo -ne "\033[2;0f"; | |
pkill -9 -l .*VShieldScanner; | |
echo "DIE"; | |
fi; | |
sleep 5; | |
done; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment