aboutsummaryrefslogtreecommitdiff
path: root/network/amavisd-new/rc.amavisd
blob: b30ddd9c26a4f112544e7663850d7d17d39094af (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh

# Copyright (c) 2008-2010, Nishant Limbachia, Hoffman Estates, IL, USA

# /etc/rc.d/rc.amavisd
# start|stop|restart|status for amavisd-new

# For automatic startup at boot, call this script from rc.local

PIDFILE=/var/run/amavis/amavisd.pid

amavisd_start() {
  if [ -x /etc/rc.d/rc.amavisd ]; then
	if [ -f $PIDFILE ]; then
		echo "amavisd-new daemon running with PID: $(cat $PIDFILE)"
		echo "try /etc/rc.d/rc.amavisd stop|restart"
		echo ""
		exit 1
	else
		echo "Starting amavisd-new daemon"
    		/usr/sbin/amavisd start
	fi
  fi
}

amavisd_stop() {
	if [ -f $PIDFILE ]; then
		echo "Stopping amavisd-new daemon"
		/usr/sbin/amavisd stop
	else
		echo "amavisd-new daemon is not running"
	fi
}

amavisd_restart() {
	echo "Restarting amavisd-new daemon"
	/usr/sbin/amavisd reload
}

amavisd_status() {
	echo "amavisd-new daemon running with PID: $(cat $PIDFILE)"
}

case "$1" in
'start')
	amavisd_start
  ;;
'stop')
	amavisd_stop
  ;;
'restart')
	amavisd_restart
  ;;
'status')
	amavisd_status
  ;;
*)
	echo "USAGE: $0 start|stop|restart|status"
	exit 1
  ;;
esac