summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/lighttpd/spawn-php.rc.d
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2008-11-09 02:33:06 (GMT)
committerJames Meyer <james.meyer@operamail.com>2008-11-09 02:33:06 (GMT)
commit1ba69cc033dfbd0a6c4c29c6d877c7e753f96e8e (patch)
treef336ee91ce16c6591fff50340562e07e15aa1a55 /abs/mv-core/lighttpd/spawn-php.rc.d
parent75b1bceb21faab32d8f519d6f7f7062a226f9047 (diff)
downloadlinhes_pkgbuild-1ba69cc033dfbd0a6c4c29c6d877c7e753f96e8e.zip
linhes_pkgbuild-1ba69cc033dfbd0a6c4c29c6d877c7e753f96e8e.tar.gz
linhes_pkgbuild-1ba69cc033dfbd0a6c4c29c6d877c7e753f96e8e.tar.bz2
MythVantage specific pkgs
Diffstat (limited to 'abs/mv-core/lighttpd/spawn-php.rc.d')
-rwxr-xr-xabs/mv-core/lighttpd/spawn-php.rc.d67
1 files changed, 67 insertions, 0 deletions
diff --git a/abs/mv-core/lighttpd/spawn-php.rc.d b/abs/mv-core/lighttpd/spawn-php.rc.d
new file mode 100755
index 0000000..cbda262
--- /dev/null
+++ b/abs/mv-core/lighttpd/spawn-php.rc.d
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/spawn-php ] && . /etc/conf.d/spawn-php
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+
+PID=`pidof -o %PPID ${FCGIPROGRAM}`
+case "$1" in
+ start)
+ stat_busy "Starting ${SPAWN_DAEMON_NAME}"
+ if [ -z "$PID" ]; then
+ ################## no config below this line
+ if test x$PHP_FCGI_CHILDREN = x; then
+ PHP_FCGI_CHILDREN=5
+ fi
+ export PHP_FCGI_MAX_REQUESTS
+ export FCGI_WEB_SERVER_ADDRS
+
+ ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS"
+
+ # negotiate the parameters for the php-cgi spawn program
+ EX="$SPAWNFCGI -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN"
+ if [ -z "$FCGISOCKET" ]; then
+ EX="$EX -p $FCGIPORT"
+ else
+ EX="$EX -s $FCGISOCKET"
+ fi
+ if test x$UID = x0; then
+ EX="$EX -u $USERID -g $GROUPID"
+ fi
+ if [ ! -z "$CHROOTDIR" ]; then
+ EX="$EX -c $CHROOTDIR"
+ fi
+
+ # copy the allowed environment variables
+ E=
+ for i in $ALLOWED_ENV; do
+ E="$E $i=${!i}"
+ done
+ # clean environment and set up a new one
+ env - $E $EX > /dev/null
+ add_daemon ${SPAWN_DAEMON_NAME}
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ${SPAWN_DAEMON_NAME}"
+ if [ ! -z "$PID" ]; then
+ killall ${FCGIPROGRAM}
+ rm_daemon ${SPAWN_DAEMON_NAME}
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+
+