"Fossies" - the Fresh Open Source Software Archive

Member "passwd_exp-1.2.11/passwd_exp-admin.cron" (17 Mar 2005, 1180 Bytes) of package /linux/privat/old/passwd_exp-1.2.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #! /bin/sh
    2 # passwd_exp weekly check script
    3 #####
    4 # Run (WEEKLY) password expiration check program ( passwd_exp )
    5 #  by Sam <samkob@gmail.com>
    6 ####
    7 
    8 #setup command path replaced by install script
    9 exec_prefix="@prefix@"
   10 passwd_exp="@sbindir@/passwd_exp"
   11 MAIL=@MAILX@
   12 MAILTO=root
   13 
   14 #first run the passwd_exp program
   15 LIST=`$passwd_exp -l 2>&1`
   16 RETVAL=$?
   17 RETERR=$LIST
   18 
   19 #if list not empty send email to admin
   20 if test "$RETVAL" = "0" && test "$LIST";
   21     then #send email
   22          DATE=`date`
   23          cat << __EOF__ | $MAIL -s "User Expiration Status report" $MAILTO
   24 List of expired/expiring users in system:
   25 
   26 $LIST
   27 
   28 ---
   29   Report generated by $0 on $DATE.
   30 __EOF__
   31          RETVAL=$?
   32          RETERR="Failed sending status report e-mail to $MAILTO."
   33 fi
   34 
   35 
   36 #check returned ( nothing is good ), on error report error to stderr
   37 if ! test "$RETVAL" = "0";
   38   then 
   39   DATE=`date`
   40   cat <<__EOF__ >&2
   41   Error running password expiration checks
   42 
   43   There occured some error(s) while running password
   44     expiration program checks by cron.
   45 
   46   Program command line:
   47 $passwd_exp
   48   
   49   Program exited with error code "$RETVAL", returning this error message:
   50 $RETERR
   51 
   52 ---
   53   Error generated by $0 on $DATE.
   54 __EOF__
   55 
   56 fi