Cover V03, I06
Article
Figure 1
Figure 2
Listing 1
Listing 2
Listing 3
Listing 4

nov94.tar


Listing 1: kill script

:
# kill - logging script
# to install:
#     mv /bin/kill /bin/rkill
#     mv [this script] /bin/kill
#     chmod a+rx /bin/kill
#     chgrp and chown: make /bin/kill same as /bin/rkill
#     chmod a+rw /usr/spool/log/kill.log
# You may have to alter the /bin/ps flags for your system

log=/usr/spool/log/kill.log

# record who is doing what, when, and from where
echo "`date` `id` `logname`
cwd=`pwd`
kill $*
" >> $log

for num in "$@"
do
# if kill-level was specified, just
# continue.  For example: kill -9 234

case "$num" in
-*) continue ;;
esac

# get information about the process to be killed
/bin/ps -lfp $num >> $log 2>&1
done

# echo blank line to make reading easier
echo >> $log

# now call real kill with same arguments
exec /bin/rkill "$@"