I noticed that in post "thread690-1359647", users were looking for a script to kick users off of the CMS after a certain length of time. I have something that I use, and it works great.
***************
#!/usr/bin/ksh
ps -ef | grep /cms/bin/chipr | egrep 'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec' | awk '$1> 60 {print $1" "$3}' | \
while read -r NAME PID
do
if [ "$NAME" = "someuser" ] || [ "$NAME" = "someuser" ]
then
echo "protected user" >/dev/null
else
kill -KILL $PID
fi
done
***************
Since this looks at the chipr, the return will only bring back folks in the system that are connected to CenterVue. Any user that has logged in within 24 hours, will have a time stamp instead of a "Nov 5 00:00" entry. So the egrep grabs only those users not logged in the day the script is ran.
This also protects root, console, etc.users, from being included, like in a"who -uH" command.
You can replace the "kill -KILL" command with "echo", and you can see the PIDS that will be killed painted to the screen.
Thanks,
Johnny
***************
#!/usr/bin/ksh
ps -ef | grep /cms/bin/chipr | egrep 'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec' | awk '$1> 60 {print $1" "$3}' | \
while read -r NAME PID
do
if [ "$NAME" = "someuser" ] || [ "$NAME" = "someuser" ]
then
echo "protected user" >/dev/null
else
kill -KILL $PID
fi
done
***************
Since this looks at the chipr, the return will only bring back folks in the system that are connected to CenterVue. Any user that has logged in within 24 hours, will have a time stamp instead of a "Nov 5 00:00" entry. So the egrep grabs only those users not logged in the day the script is ran.
This also protects root, console, etc.users, from being included, like in a"who -uH" command.
You can replace the "kill -KILL" command with "echo", and you can see the PIDS that will be killed painted to the screen.
Thanks,
Johnny