Last active
February 21, 2022 23:04
-
-
Save igorhrq/a890a3e19020f88a07c55b410d7d7339 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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