#! /bin/sh : &&O='cd .' || exec /bin/sh "$0" $argv:q # we're in a csh, feed myself to sh $O || exec /bin/sh "$0" "$@" # we're in a buggy zsh ######################################################################### # mindlists To send notices or reminders to list owners # # and members # # # # Created by Alan K. Stebbens # ######################################################################### # $Id: mindlist,v 1.2 1999/03/30 18:17:37 guenther Exp $ echo mindlist: Customise first exit 64 # Site configuration (should be externalized) # domain=hub.ucsb.edu listmaster=lists@$domain admin="\"Mailing List Mailer-Daemon\" <$listmaster>" # cd $HOME # Syntax: reminder [-d] [-n] [-u] [-o] list ... test=test # /bin/test ln=ln # /bin/ln rm=rm # /bin/rm cp=cp # /bin/cp echo=echo # /bin/echo cat=cat # /bin/cat awk=awk # /bin/awk SENDMAIL=/usr/lib/sendmail usage="usage: mindlists [-d] [-n] [-u] [-o] list ..." lists= while $test $# -gt 0 do case "$1" in -d|-debug) debug=1 ;; -o|-owners) owners=1 ;; -u|-users) users=1;; -m|-moderators) moders=1 ;; -n|-new) new=1 ;; -*) $echo $usage 1>&2 && exit 64 ;; *) lists="$lists $1" ;; esac shift done if $test -z "$lists" ; then lists="`ls | tr '\012' ' '`" fi ifdebug () { if $test -n "$debug" ; then "$@" fi } ifndebug () { if $test -z "$debug" ; then "$@" fi } decho () { ifdebug echo "$@" } necho () { ifndebug echo "$@" } sendmail () { if $test -n "$debug" ; then echo $SENDMAIL $* cat else $SENDMAIL $* fi } ####################### # welcome the owner to his/her new list welcome_owner () { if $test -z "${owner}" ; then echo List ${list} has no owner. return fi necho "Sending welcoming mail to $owner.." $cat < Welcome to the mailing list "$listaddr". EOF if $test -f $list/info.txt ; then echo "The purpose of this list is:" echo "" $cat $list/info.txt echo "" fi $cat < This is a reminder that you are a member of the list "$listaddr", and a verification of your address. You need do nothing to remain subscribed -- just the process of successfully sending this mail to you automatically renews your membership. If you wish to be removed from this list, please send an e-mail with the subject of "unsubscribe" to "$listreq". If you have any difficulties with this list, please contact the list owner at $owner. EOF } # Send welcome/reminder to moderators welcome_moderators () { flag=`$awk '/^moderated_flag/{print $3}' $list/rc.custom 2>/dev/null` if $test "${flag}" != yes ; then echo List $list is not moderated return fi necho -n "Sending welcome mail to moderators of list \"$list\".." for moderator in $moderators do necho -n " $moderator" ( $cat < Welcome as a moderator of the list "$listaddr". You have been selected as a moderator of the list "$listaddr". This means that you, along with any other moderators, will receive unmoderated submissions to "$list". If you choose to authorize the submission, you must resend the mail with the following header added: Approved: $moderator If you choose to not authorize a particular submission, simply ignore it. Any moderator may choose to authorize a submission, but only the first approved submission will actually be forwarded to the list; succeeding authorizations of the same submission will be filtered automatically. The current list of moderators for list "$list" is: EOF echo "$moderators" | tr ' ' '\012' $cat </dev/null` if $test "${flag}" != yes ; then echo List $list is not moderated return fi necho -n "Sending reminder to moderators of list \"$list\".." for moderator in $moderators do necho " $moderator" ( $cat < This is a reminder of your status as a moderator of the list "$listaddr". You do not need to reply to this message, unless you have questions or concerns regarding, or no longer wish to act as a moderator for the list "$listaddr". A reminder of your duties as moderator: You will receive unmoderated submissions to the list "$list". If you choose to authorize a particular submission, you must resend the mail with the following header added: Approved: $moderator If you choose to not authorize a particular submission, simply ignore it. Any moderator may choose to authorize a submission, but only the first approved submission will actually be forwarded to the list; succeeding authorizations of the same submission will be filtered automatically. The current list of moderators for list "$list" is: EOF echo "$moderators" | tr ' ' '\012' ) | sendmail -oi -t done necho "" } # Collect all owners, users, and moderators for list in $lists do $test -d $list || continue listaddr=${list}@${domain} listreq=${list}-request@${domain} owner=`$awk '/^maintainer/{print $3;exit}' $list/rc.custom $list/rc.init 2>/dev/null` passwd=`$awk '/^X_COMMAND_PASSWORD/{print $3}' $list/rc.custom 2>/dev/null` moderators= if $test -f $list/moderators; then moderators="`(cat $list/moderators 2>/dev/null) | tr '\012' ' '`" fi # Invoke either "welcome_" or "remind_" what='remind' if $test -n "$new"; then what='welcome' fi if $test -n "$owners" ; then eval "$what\_owner" fi if $test -n "$moders"; then eval "$what\_moderators" fi if $test -n "$users"; then eval "$what\_users" fi done