brossetti1
10/15/2017 - 5:17 PM

kill processes

export PROCESSES_TO_QUIT='bpos puma rake sidekiq spring rails$ ruby-debug phantomjs zeus passenger guard resque "node server.js" ruby$ node foreman fsevent_wat'

pgr() {
    echo "Finding processes in list: $PROCESSES_TO_QUIT"
    echo $PROCESSES_TO_QUIT | xargs -n 1 pgrep -l
}

pgk() {
    echo "Killing processes in list: $PROCESSES_TO_QUIT"
    echo $PROCESSES_TO_QUIT | xargs -n 1 pkill -l
}

ZEUS_SOCK=/Users/justin/clients/blink/bpos/.zeus.sock

pgkk() {
    echo "Killing -9 processes in list: $PROCESSES_TO_QUIT"
    echo "Also removing $ZEUS_SOCK if existing"
    echo $PROCESSES_TO_QUIT | xargs -n 1 pkill -9 -l
    if [[ -a ${ZEUS_SOCK} ]]; then
        rm ${ZEUS_SOCK}
        echo Removed ${ZEUS_SOCK}
    else
        echo ${ZEUS_SOCK} does not exist
    fi
}