File: mysqmail-pure-ftpd-logger.init

package info (click to toggle)
mysqmail 0.4.9-10.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 428 kB
  • sloc: ansic: 1,340; sh: 695; makefile: 132
file content (70 lines) | stat: -rw-r--r-- 1,722 bytes parent folder | download | duplicates (6)
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
62
63
64
65
66
67
68
69
70
#!/bin/sh

### BEGIN INIT INFO
# Provides:          mysqmail-pure-ftpd-logger
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      mysql
# Should-Stop:       mysql
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: A MySQL traffic logger for the pure-ftpd transfer.log
# Description:       This is a (very small) daemon will log all pure-ftpd traffic
#                    to SQL, splitting the information by domains and
#                    users so it's then very easy to count all the ftp traffic for
#                    a given domain name in real time.
### END INIT INFO

PATH=$PATH:/bin:/usr/bin:/usr/sbin
DESC="MySQMail pure-ftpd logger"
NAME=mysqmail-pure-ftpd-logger
DAEMON=/usr/sbin/${NAME}
PID_FILE=/var/run/${NAME}.pid
PATH_CONF_FILE=/etc/mysqmail.conf

if ! [ -f "${PATH_CONF_FILE}" ] ; then
	echo "${PATH_CONF_FILE} not present: exiting silently"
	exit 0
fi

if [ ! -x ${DAEMON} ] ; then
	echo "${DAEMON} not executable or not present!"
	exit 1
fi

. /lib/lsb/init-functions

RET=0
case "$1" in
start)
	if [ ! -f ${PID_FILE} ] ; then
		log_daemon_msg "Starting ${DESC}" "${NAME}"
		start-stop-daemon -S --quiet -p ${PID_FILE} --exec "${DAEMON}"
		RET=$?
		log_end_msg $?
	else
		echo "${PID_FILE} already exists: not starting ${DAEMON}"
	fi
	exit ${RET}
;;
stop)
	if [ -f ${PID_FILE} ] ; then
		log_daemon_msg "Stopping ${DESC}" "${NAME}"
		start-stop-daemon -K --quiet -p ${PID_FILE}
		RET=$?
		log_end_msg $?
	else
		echo "${PID_FILE} doesn't exist: not stoping ${DAEMON}"
	fi
;;
restart | reload | force-reload)
	$0 stop
	sleep 2
	$0 start
;;
*)
	echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
	exit 1
esac

exit 0