You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
711 B

#!/bin/bash
attempt_interrupt() {
export TEST="$(ps -aux | grep './redditgetter.py' | grep -v grep | grep -v bash | sed -e 's/ */ /g' | cut -d' ' -f2)";
if [ -n "$TEST" ] ; then
echo "Killing...";
echo "$TEST" | xargs -rl1 -- kill -2;
sleep 1;
fi
}
force_interrupt() {
export TEST="$(ps -aux | grep './redditgetter.py' | grep -v grep | grep -v bash | sed -e 's/ */ /g' | cut -d' ' -f2)";
if [ -n "$TEST" ] ; then
echo "Force-Killing...";
echo "$TEST" | xargs -rl1 -- kill -15;
sleep 1;
fi
}
attempt_interrupt
attempt_interrupt
attempt_interrupt
attempt_interrupt
attempt_interrupt
attempt_interrupt
attempt_interrupt
attempt_interrupt
attempt_interrupt
attempt_interrupt
force_interrupt