home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # Shell script to add a peer list to a discussion list.
- #
- # Usage: peer <LIST_ALIAS> <remote alias> <remote peer email address>
- # <remote peer listserv email address>
- # where:
- # LIST_ALIAS: a local list alias, capitalized, that is to be connected to
- # the new peer.
- # remote alias: the peer's list alias on the remote machine
- # remote peer email address: full email address of the peer list to be added
- # remote peer listserv email address: full email address of the server
- # that handles the remote peer.
-
- PROG=`basename $0`
- if [ $# -lt 4 ]; then
- echo Usage: $PROG \<LIST_ALIAS\> \<remote alias\> \
- \<remote $PROG email address\> \<remote $PROG listserv email address\>
- exit 1
- fi
-
- ARGS=$PROG\ $*
- DIR=/usr/server/lists/`echo $1 | tr '[a-z]' '[A-Z]'`
- REMOTE_ALIAS=`echo $2 | tr '[A-Z]' '[a-z]'`
- EMAIL=`echo $3 | tr '[A-Z]' '[a-z]'`
- REMOTE_SERVER=`echo $4 | tr '[A-Z]' '[a-z]'`
- REPORT=/usr/server/.report.server
- CONFIG=/usr/server/config
- MODE=NOACK
- FILE=$DIR/.peers
- shift; shift; shift; shift
-
- if [ ! -d $DIR ]; then
- echo $DIR: no such list
- exit 2
- fi
- if [ ! -r $CONFIG ]; then
- echo Cannot open $CONFIG
- exit 2
- fi
- if [ ! -r $FILE ]; then
- echo Cannot open $FILE
- exit 2
- fi
-
- echo >> $REPORT
- echo --- NEW MAIL HAS ARRIVED --- >> $REPORT
- echo $ARGS >> $REPORT
- LOCAL=`grep -i "^list *$REMOTE_ALIAS *$EMAIL" $CONFIG | awk '{ print $2 }'`
- if [ "$LOCAL" = "" ]; then
- LOCAL=`grep -i "^server\ *$EMAIL" $CONFIG | awk '{ print $2 }'`
- txt=server
- else
- txt=list
- fi
- if [ "$LOCAL" != "" ]; then
- echo Cannot add local $txt $LOCAL as $PROG to $FILE >&1 | tee -a $REPORT
- else
- if [ "`grep -i $EMAIL $FILE`" != "" ]; then
- echo $EMAIL\: Already subscribed as a $PROG in $FILE >&1 | tee -a $REPORT
- else
- echo $EMAIL $MODE $REMOTE_ALIAS $REMOTE_SERVER >> $FILE
- fi
- fi
- echo Time/Date: `date` >> $REPORT
- exit 0
-