Skip to content

Instantly share code, notes, and snippets.

@igorhrq
Last active February 21, 2022 23:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorhrq/a890a3e19020f88a07c55b410d7d7339 to your computer and use it in GitHub Desktop.
Save igorhrq/a890a3e19020f88a07c55b410d7d7339 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Kill all pts sessions that are not you and leave a message for all theses.
# Version 0.1
# Author: Igor A.
#
# usage: $ killpts [TICKET]
# usage 2: $ killpts
# example: $ killpts 2565489
#
ticket=$1
var1=$(who am i | awk '{print $2}')
var2=$(who | awk '{print $2}' |egrep -v $var1)
EMPNAME="IgorA"
for i in `echo $var2`
do
echo "Another Analyst are working on this server, please talk with $EMPNAME on private or on Ticket $ticket" > /dev/$i
fuser -k /dev/$i
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment