Can remove the sender and/or the recipient from the key of the greylister.
[apps/pfixtools.git] / example / postlicyd.initd.sh
1 #!/bin/sh
2
3 die() {
4   echo "$1"
5   exit 1
6 }
7
8 POSTLICYD=/usr/sbin/postlicyd
9 PIDFILE=/var/run/postlicyd/pid
10 CONF=/etc/pfixtools/postlicyd.conf
11
12 [ -z $1 ] && die "usage $0 (start|stop|reload)"
13
14 case "$1" in
15   start)
16     mkdir -p `dirname "$PIDFILE"` || die "Can't create $PIDFILE"
17     echo "Starting postlicyd..."
18     flock -x -n "$PIDFILE" -c "true" || die "Already started"
19     $POSTLICYD -p "$PIDFILE" "$CONF" || die "Failed"
20     echo "Started"
21     ;;
22
23   stop)
24     echo "Stopping postlicyd..."
25     ( flock -x -n "$PIDFILE" -c "true" && die "Not started" ) \
26       || ( kill `cat $PIDFILE` && echo "Stopped" ) \
27       || die "Failed"
28     ;;
29
30   reload)
31     echo "Reloading postlicyd..."
32     ( flock -x -n "$PIDFILE" -c "true" && die "Not started" ) \
33       || ( kill -HUP `cat $PIDFILE` && ( sleep 3; echo "Done" ) ) \
34       || die "Failed"
35     ;;
36
37   *)
38     die "usage $0 (start|stop|reload)"
39     ;;
40 esac