Mini Shell

Direktori : /proc/self/root/opt/sharedrads/oldrads/
Upload File :
Current File : //proc/self/root/opt/sharedrads/oldrads/check_autoprockills

#!/bin/bash
# Shared RADS Tools, written by Erik Soroka (eriks@imhadmin.net, ext 834)

CHECKUSER=$1
SESSIONID=$2

if [ -z $1 ]; then
echo
echo "Usage: check_autoprockills [username]"
echo
exit 0
fi

if [ -z $2 ]; then
SESSIONID=`date +%s`
DETAILED=YES
fi

if [ "$2" == "--plaintext" ]; then
RADSCOLORS=off
fi

	echo

    	#determine home directory
        USERHOME=$(awk -F: -v v="$CHECKUSER" '{if ($1==v) print $6}' /etc/passwd)

        if [ ! -d $USERHOME ]; then
                echo "ERROR: could not determine home directory for $user: $USERHOME"
		exit
        fi

	#lets see if we have autoprockills data for this user
        if [ -f $USERHOME/.imh/autoprockills ]; then
                HOWMANY=$(grep KILLED $USERHOME/.imh/autoprockills | wc -l)
		echo
                echo -e "\033[31;1m Auto Process Killer has logged $HOWMANY strike(s) against $CHECKUSER's running processes recently:\033[0m"
                echo
                cat $USERHOME/.imh/autoprockills
		echo
	else
		echo
		echo -e "\033[32;1m Auto Process Killer has not logged any strikes against $CHECKUSER this month."
		echo
        fi

Zerion Mini Shell 1.0