home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / remind-03.00.19.tgz / remind-03.00.19.tar / remind-03.00.19 / scripts / remind-all.csh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1998-01-14  |  2KB  |  47 lines

  1. #!/bin/csh -f
  2.  
  3. # Shell script to mail all users reminders.
  4.  
  5. # $Id: remind-all.csh,v 1.1 1998/01/15 02:50:21 dfs Exp $
  6.  
  7. # Run it AFTER MIDNIGHT so that date is correct!
  8. # On our system, we have the following in our crontab:
  9. # 05 5 * * * /usr/share/lib/remind/remind-all > /dev/null 2>&1
  10.  
  11. # This script must be run by root.  The -u option MUST be supplied
  12. # to Remind, or a severe security hole will exist.  Note that Remind
  13. # must be compiled to support the -u option for this script to work.
  14. # Also, the -r and -q options must be used.
  15.  
  16. # The following line gets a list of users for systems using SUN's
  17. # NIS service:
  18. set USERS  = `ypcat passwd | awk -F: '{print $1}'`
  19.  
  20. # The following line gets a list of users by examining /etc/passwd:
  21. # set USERS = `awk -F: '{print $1}' /etc/passwd`
  22.  
  23. # If neither of the above methods works, you must come up with some
  24. # way of getting a list of users on the system
  25.  
  26. # Set the following variables as appropriate for your system
  27. set REMIND = /usr/local/bin/remind
  28. set MAIL   = /usr/ucb/mail
  29. set RM     = "/usr/bin/rm -f"
  30.  
  31. set REMFILE   = /tmp/RemFile.$$
  32.  
  33. # Scan each user's directory for a .reminders file
  34. foreach i ($USERS)
  35.    if (-r ~$i/.reminders) then
  36. #     echo "$i has a .reminders file."     DEBUGGING PURPOSES ONLY
  37.  
  38.       $REMIND -u$i -h -r -q -iremind_all=1 ~$i/.reminders < /dev/null > $REMFILE
  39.       if (! -z $REMFILE) then
  40. #        echo "Sending mail to $i"         DEBUGGING PURPOSES ONLY
  41.  
  42.          $MAIL -s "Reminders" $i < $REMFILE
  43.       endif
  44.       $RM $REMFILE
  45.    endif
  46. end
  47.