#!/bin/csh
#delete all files for users that haven't logged on for 
#the specified number of days.

if (! -d "userdata") then
        echo "Can't find userdata directory. Are you in the right place?"
        exit
endif

#Protect the Wizards and SU accounts from deletion
if ("`tty`" !~ "tty[pq]*") then
	echo Protecting accounts for Wizards, SUs, and any other special users...
endif
/usr/local/talker/bin/protect_su

#Change 'cat' to 'sh' in the following line to delete the old account files
if ("`tty`" !~ "tty[pq]*") then
	echo Deleting old user accounts...
endif
find userdata -type f -mtime $1 -print | $0.pl $1 | Mail -s "Report of unused talker accounts" talker-admin
