Gentoo Archives: gentoo-commits

From: "Christian Ruppert (idl0r)" <idl0r@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-proxy/haproxy/files: haproxy.initd-r1
Date: Wed, 28 Sep 2011 15:23:14
Message-Id: 20110928152302.0271F20036@flycatcher.gentoo.org
1 idl0r 11/09/28 15:23:01
2
3 Added: haproxy.initd-r1
4 Log:
5 Improve haproxy init script, bug 384753. Also fix use of deprecated opts variable.
6
7 (Portage version: 2.2.0_alpha59/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 net-proxy/haproxy/files/haproxy.initd-r1
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-proxy/haproxy/files/haproxy.initd-r1?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-proxy/haproxy/files/haproxy.initd-r1?rev=1.1&content-type=text/plain
14
15 Index: haproxy.initd-r1
16 ===================================================================
17 #!/sbin/runscript
18 # Copyright 1999-2011 Gentoo Foundation
19 # Distributed under the terms of the GNU General Public License v2
20 # $Header: /var/cvsroot/gentoo-x86/net-proxy/haproxy/files/haproxy.initd-r1,v 1.1 2011/09/28 15:23:01 idl0r Exp $
21
22 extra_commands="checkconfig reload"
23
24 CONFFILE=/etc/${SVCNAME}.cfg
25 PIDFILE=/var/run/${SVCNAME}.pid
26
27 depend() {
28 need net
29 use dns logger
30 }
31
32 checkconfig() {
33 if [ ! -f "${CONFFILE}" ]; then
34 eerror "${CONFFILE} does not exist!"
35 return 1
36 fi
37
38 ebegin "Checking ${CONFFILE}"
39 /usr/bin/haproxy -q -c -f "${CONFFILE}"
40 eend $?
41 }
42
43 start() {
44 ebegin "Starting ${SVCNAME}"
45 start-stop-daemon --pidfile "${PIDFILE}" --exec /usr/bin/haproxy \
46 --start -- -D -p "${PIDFILE}" -f "${CONFFILE}"
47 eend $?
48 }
49
50 stop() {
51 ebegin "Stopping ${SVCNAME}"
52
53 if [ "${RC_CMD}" = "restart" ]; then
54 checkconfig || return 1
55 fi
56
57 start-stop-daemon --stop --pidfile "${PIDFILE}"
58 eend $?
59 }
60
61 reload() {
62 ebegin "Reloading ${SVCNAME}"
63 checkconfig || { eerror "Reloading failed, please fix your ${CONFFILE} first"; return 1; }
64 /usr/bin/haproxy -D -p "${PIDFILE}" -f "${CONFFILE}" -sf $(cat "${PIDFILE}")
65 eend $?
66 }