updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / greylistd / greylistd.sh
blob5bf9bec7d8f723a5c30ccb663c5e96c064af0848
1 #!/bin/bash
3 client=/usr/bin/greylist
4 daemon=/usr/sbin/greylistd
5 rundir=/var/run/greylistd
6 datadir=/var/lib/greylistd
7 pidfile=$rundir/pid
8 socket=$rundir/socket
9 user=greylist
10 group=greylist
12 . /etc/rc.conf
13 . /etc/rc.d/functions
15 # See if the daemon is present
16 test -x "$daemon" || exit 0
18 # Make sure /var/run/greylistd exists (/var/run may be a tmpfs)
19 test -d "$rundir" || {
20 mkdir -p "$rundir"
21 chown "$user:$group" "$rundir"
24 case "$1" in
25 start)
26 stat_busy "Starting Greylistd"
28 if [ -e "$socket" ]
29 then
30 echo "$0:"
31 echo " Another instance of \`${daemon##*/}' seems to be running."
32 echo " If this is not the case, please remove \"$socket\"."
33 stat_fail
34 exit 1
37 start-stop-daemon --start --background \
38 --chuid "$user" \
39 --pidfile "$pidfile" --make-pidfile \
40 --exec "$daemon"
41 add_daemon greylistd
42 stat_done
45 stop)
46 stat_busy "Stopping Greylistd"
47 start-stop-daemon --stop --pidfile "$pidfile" &&
48 rm -f "$pidfile"
49 rm_daemon greylistd
50 stat_done
53 reload|force-reload)
54 "$client" reload
57 status)
58 "$client" stats
61 restart)
62 $0 stop
63 sleep 2
64 $0 start
68 echo "Usage: $0 {start|stop|restart|reload|force-reload|status}" >&2
69 exit 1
71 esac
73 exit 0