File: masqmail_route

package info (click to toggle)
whereami 0.3.37
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 424 kB
  • sloc: sh: 1,094; perl: 524; makefile: 24
file content (31 lines) | stat: -rwxr-xr-x 1,062 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
#
# $Id: masqmail_route,v 1.3 2002/11/01 22:05:29 andrew Exp $
#
# Integration (well sort of :-) of whereami with masqmail.
#
# This script looks at the masqmail configuration of the online
# file (usually "/tmp/connect_route") and removes it. If one of
# our current locations matches a location for which masqmail
# is configured then we create a new file with that location.
#

# whereami sets the list of locations to be comma-separated - possibly a mistake!
LOCATIONS="`echo ${LOCATION} | tr ',' ' '`"

# Work out what masqmail has specified for the notification file
ONLINE_FILE="`grep "^online_file *=" /etc/masqmail/masqmail.conf | cut -f2 -d= | tr -d \\"\\  `"

# Remove any existing indications of which location we should use
rm -f ${ONLINE_FILE}

for LOCN in ${LOCATIONS} ; do
  if grep "^connect_route.${LOCN} *=" /etc/masqmail/masqmail.conf >/dev/null ; then
    logger -t whereami -i "Setting masqmail route in ${ONLINE_FILE} to \"${LOCN}\""
    echo "${LOCN}" > ${ONLINE_FILE}

    # We exit on the first success
    exit 0;
  fi
done