aboutsummaryrefslogtreecommitdiffstats
path: root/main/lighttpd/spawn-fcgi.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
commitb70981b68efcce5256eb11c6cd26ae123b10b6ea (patch)
treea38be6efae5e2ba15c2e839504632f9b7bfd5f91 /main/lighttpd/spawn-fcgi.initd
parent2b4df81538b8398442d5296650905c70341dd8d3 (diff)
downloadaports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.bz2
aports-b70981b68efcce5256eb11c6cd26ae123b10b6ea.tar.xz
moved extra/* to main/
and fixed misc build issues
Diffstat (limited to 'main/lighttpd/spawn-fcgi.initd')
-rw-r--r--main/lighttpd/spawn-fcgi.initd51
1 files changed, 51 insertions, 0 deletions
diff --git a/main/lighttpd/spawn-fcgi.initd b/main/lighttpd/spawn-fcgi.initd
new file mode 100644
index 0000000000..63daa75081
--- /dev/null
+++ b/main/lighttpd/spawn-fcgi.initd
@@ -0,0 +1,51 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/spawn-fcgi.initd,v 1.2 2007/04/02 12:46:08 uberlord Exp $
+
+SPAWNFCGI_PID="/var/run/spawn-fcgi.pid"
+
+depend() {
+ need net
+}
+
+start() {
+ local my_end
+
+ ebegin "Starting spawn-fcgi"
+ export PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS
+
+ EX="${SPAWNFCGI} -p ${FCGIPORT} -f ${FCGIPROGRAM} -u ${USERID} \
+ -g ${GROUPID} -C ${PHP_FCGI_CHILDREN}"
+
+ # copy the allowed environment variables
+ unset E
+ for i in ${ALLOWED_ENV}; do
+ E="${E} ${i}=${!i}"
+ done
+
+ # clean environment and set up a new one
+ env - ${E} ${EX} 2>${SPAWNFCGI_PID}
+ my_end=$?
+ if [ "$my_end" != "0" ]; then
+ [ -f ${SPAWNFCGI_PID} ] && rm -f ${SPAWNFCGI_PID}
+ eend $my_end
+ fi
+
+ #extract parent-process-id and write it back to the file
+ FCGI_PPID=`cat ${SPAWNFCGI_PID} | cut -d':' -f4`
+ echo ${FCGI_PPID} > ${SPAWNFCGI_PID}
+ eend 0
+}
+
+stop() {
+ ebegin "Stopping spawn-fcgi"
+ if ! kill `cat ${SPAWNFCGI_PID}` ; then
+ eend $?
+ return 1
+ fi
+ if [ -w ${SPAWNFCGI_PID} ]; then
+ rm ${SPAWNFCGI_PID}
+ fi
+ eend 0
+}