head 1.5; access; symbols; locks; strict; comment @# @; 1.5 date 99.04.28.11.08.50; author alexis; state Exp; branches; next 1.4; 1.4 date 99.02.20.18.08.59; author alexis; state Exp; branches; next 1.3; 1.3 date 99.01.07.13.18.23; author alexis; state Exp; branches; next 1.2; 1.2 date 98.08.28.17.40.23; author alexis; state Exp; branches; next 1.1; 1.1 date 98.08.28.13.38.13; author alexis; state Exp; branches; next ; desc @SHPP PORT OF mail-sendmail+fetchmail.in (1.1) @ 1.5 log @added gep.sh.shpp dependency and use @ text @#!MARKER_SHELL_CMD PATH=/bin:/usr/bin PROGNAME=`basename $0` ############################################################################### # # # MAIL TRANSFER PROGRAM - USES SENDMAIL (SEND) AND FETCHMAIL (GET) # # # ############################################################################### ############################################################################### # # Things you should know about this script: # # It is stored under RCS! Keep it that way! If you want a history of # changes made to this script then refer to rlog(1) - don't look here! # ############################################################################### ############################################################################### # # CONFIGURABLE STUFF STARTS HERE # ############################################################################### ############################################################################### # # CONFIGURABLE STUFF ENDS HERE # ############################################################################### FACILITY=mail VERSION="MARKER_PATCHLEVEL" # $Header: /diskb/home/alexis/dev/supported/ppplc/lib/mail/RCS/mail-sendmail+fetchmail.shpp,v 1.4 1999/02/20 18:08:59 alexis Exp alexis $ ############################################################################### # # MAIN FUNCTION (called from very bottom of script) # ############################################################################### main() { ########################################################################### # # PROCESS OPTIONS # ########################################################################### while [ "X$1" != X ]; do case "$1" in -V) echo "$PROGNAME version $VERSION" exit 0 ;; -d) [ "X$2" = X ] && usage VERBOSE_LEVEL=$2 shift ;; -v) VERBOSE_LEVEL=3 ;; -*) usage ;; *) break ;; esac shift done # list of users or the word 'all' must be supplied. [ "X$1" != X ] && usage # Are locks required? Yes. Sendmail does it's own locking, but for # fetchmail it might be advisable. But we lock it now just to # ensure we don't get half way through and then generate an error. lock DUMMY gen_lock_file_name || error "lock failed" ########################################################################### # # SEND MAIL # ########################################################################### exec MARKER_SENDMAIL_CMD -q ########################################################################### # # GET MAIL # ########################################################################### # Nothing to do! for ID in $*; do [ $ID = all ] && { error -f "'all' is not supported yet"; break; } info "retrieving mail for $ID" if [ $VERBOSE_LEVEL -ge 3 ]; then su - $ID -c "MARKER_FETCHMAIL_CMD -v" else su - $ID -c MARKER_FETCHMAIL_CMD fi done unlock DUMMY gen_lock_file_name debug 5 "all done" } gen_lock_file_name() { typeset LOCK_WHAT LOCK_WHAT=$1 echo MARKER_LOCK_DIR/$PROGNAME.pid } usage() { { echo "Usage: $PROGNAME [ -d | -v ] { ... | all }" echo " $PROGNAME -V" } >&2 exit 1 } #shpp include utils.sh.shpp #shpp include gep.sh.shpp @ 1.4 log @lock interface changed @ text @d34 1 a34 1 # $Header: /diskb/home/alexis/dev/supported/ppplc/lib/mail/RCS/mail-sendmail+fetchmail.shpp,v 1.3 1999/01/07 13:18:23 alexis Exp alexis $ d122 1 @ 1.3 log @symbol name changes @ text @d34 1 a34 1 # $Header: mail-sendmail+fetchmail.shpp,v 1.2 1998/08/28 17:40:23 alexis Exp alexis $ d71 1 a71 1 lock d99 1 a99 1 unlock d105 4 @ 1.2 log @removed version number test @ text @d1 1 a1 1 #!SCRIPTSHELLCMD_MARKER d32 3 a34 2 VERSION="PATCHLEVEL_MARKER" # $Id: mail-sendmail+fetchmail.shpp,v 1.1 1998/08/28 13:38:13 alexis Exp alexis $ d79 1 a79 1 exec SENDMAILCMD_MARKER -q d93 1 a93 1 su - $ID -c "FETCHMAILCMD_MARKER -v" d95 1 a95 1 su - $ID -c FETCHMAILCMD_MARKER d105 1 a105 1 echo LOCK_DIR_MARKER/$PROGNAME.pid d117 1 a117 2 #shpp include utils.sh @ 1.1 log @Initial revision @ text @d33 1 a33 1 # $Id: mail-sendmail+fetchmail.in,v 1.1 1998/08/07 11:33:43 alexis Exp alexis $ d52 2 a53 7 -V) if expr "$VERSION" : 'P.*R$' > /dev/null; then warning "this is a development version; use 'ident' for version information" exit 1 else echo "$PROGNAME version $VERSION" exit 0 fi ;; d104 1 a104 1 echo LOCKDIR_MARKER/$PROGNAME.pid @