blob: 22282c272886c9ffc874a16a5252db8eb4956772 (
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
|
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
depend() {
use mysql postgresql lighttpd
}
FCGI_SOCKET_PATH=${RTPATH}/var/appSocket
PIDFILE=${RTPATH}/var/pid
start() {
checkpath -d "${RTPATH}/var" -m 0755 -o "${RTUSER}:${RTGROUP}"
ebegin "Starting RT"
rm -f ${FCGI_SOCKET_PATH}
start-stop-daemon --start \
--exec ${RTPATH}/bin/mason_handler.fcgi \
--pidfile ${PIDFILE} --user "${RTUSER}:${RTGROUP}" \
--background --make-pidfile --chdir ${RTPATH} \
--stdout "${RTPATH}/var/service.log" \
--stderr "${RTPATH}/var/service.log" \
--env "PATH=$PATH" --env "FCGI_SOCKET_PATH=${FCGI_SOCKET_PATH}" \
--wait 1500
if [ "$?" != "0" ]; then
eerror "${SVCNAME} failed to start. Please see ${RTPATH}/var/service.log for the reason."
eend 1
return 1
fi
# make sure lighttpd can use the socket
for i in {0..10}; do
[ -a ${FCGI_SOCKET_PATH} ] && break
sleep 1
done
if [ -a ${FCGI_SOCKET_PATH} ]; then
chmod g+rwx ${FCGI_SOCKET_PATH}
eend 0
else
eend 1
fi
}
stop() {
ebegin "Stopping RT"
start-stop-daemon --stop --pidfile ${PIDFILE}
eend $?
}
|