Skip to content

Instantly share code, notes, and snippets.

@igorhrq
Last active Feb 21, 2022
Embed
What would you like to do?
#!/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