diff --git a/remove_user_login_node.sh b/remove_user_login_node.sh new file mode 100644 index 0000000000000000000000000000000000000000..ef984547cf06261ca6c26fa6afd490d7883750c1 --- /dev/null +++ b/remove_user_login_node.sh @@ -0,0 +1,21 @@ +#!/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