Skip to content
Snippets Groups Projects
Commit ada257b7 authored by root's avatar root
Browse files

kill nginx process running under user from login node

parent 55f85bc5
2 merge requests!85kill nginx process running under user from login node,!86kill nginx process running under user from login node
#!/bin/sh
username="$1"
usage() {
echo "Usage: $0 USERNAME"
}
if [[ "$EUID" -ne 0 ]]; then
echo "This script must be run as root!"
exit 1
fi
if [ -z "$username" ]; then
usage
exit 1
fi
if id "$username" &>/dev/null; then
echo "Deleting nginx process running under user: ${username}"
kill -9 ` ps -ef | grep 'nginx' | grep ${username} | awk '{print $2}'`
echo "Deleted process"
else
echo "user: ${username} not found."
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment