Useful CLI tools (bash) for Arch Linux administration
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.
 
 

22 lines
447 B

#!/bin/env sh
if [[ ${1} =~ ^(\-h|\-\-help)$ ]] || [[ -z ${1} ]]; then
echo "
Send a signal to a process in specified namespace.
usage: $(basename $0) <signal> <processname> <namespace>
"
exit 0
fi
signal="${1}"
processname="${2}"
namespace="${3}"
for pid in $(sudo ip netns pids ${namespace}); do
if [[ $(sudo ps -q $pid -o command) =~ ^.*${processname}.* ]]; then
sudo ip netns exec ${namespace} kill -${signal} ${pid}
fi
done