Listing 2: rm script
:
# rm - logging script
# to install:
# mv /bin/rm /bin/rrm
# mv [this script] /bin/rm
# chmod a+rx /bin/rm
# chgrp and chown: make /bin/rm same as /bin/rrm
# chmod a+rw /usr/spool/log/rm.log
# log file should be kept under maxtab control so
# it doesn't grow too large
log=/usr/spool/log/rm.log
# record who is doing what, when, and from where
echo "`date` `id` `logname`
cwd=`pwd`
rm "$@"
" >>>> $log
# now call real rm program with same arguments
exec /bin/rrm "$@"
|