pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/spawn-fcgi Initial import of spawn-fcgi-1.6.3:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9e28a9380af3
branches:  trunk
changeset: 571142:9e28a9380af3
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Mon Feb 08 14:37:54 2010 +0000

description:
Initial import of spawn-fcgi-1.6.3:

spawn-fcgi is a small utility to start external FastCGI applications.
It takes care of various common tasks to simplify deployment:
- setuid/setgid
- current working directory
- chroot
- socket creation and permissions in the case of Unix Domain Sockets
- forking a number of worker processes

diffstat:

 www/spawn-fcgi/DESCR              |    7 ++
 www/spawn-fcgi/Makefile           |   19 +++++
 www/spawn-fcgi/PLIST              |    4 +
 www/spawn-fcgi/distinfo           |    5 +
 www/spawn-fcgi/files/spawnfcgi.sh |  128 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 163 insertions(+), 0 deletions(-)

diffs (183 lines):

diff -r 658e34a254ed -r 9e28a9380af3 www/spawn-fcgi/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/spawn-fcgi/DESCR      Mon Feb 08 14:37:54 2010 +0000
@@ -0,0 +1,7 @@
+spawn-fcgi is a small utility to start external FastCGI applications.
+It takes care of various common tasks to simplify deployment:
+- setuid/setgid
+- current working directory
+- chroot
+- socket creation and permissions in the case of Unix Domain Sockets
+- forking a number of worker processes
diff -r 658e34a254ed -r 9e28a9380af3 www/spawn-fcgi/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/spawn-fcgi/Makefile   Mon Feb 08 14:37:54 2010 +0000
@@ -0,0 +1,19 @@
+# $NetBSD: Makefile,v 1.1.1.1 2010/02/08 14:37:54 joerg Exp $
+
+DISTNAME=      spawn-fcgi-1.6.3
+CATEGORIES=    www
+MASTER_SITES=  http://www.lighttpd.net/download/
+
+MAINTAINER=    joerg%NetBSD.org@localhost
+HOMEPAGE=      http://redmine.lighttpd.net/projects/spawn-fcgi
+COMMENT=       FastCGI deployment tool
+
+PKG_DESTDIR_SUPPORT=   user-destdir
+
+CONFLICTS=       lighttpd<1.4.23
+
+GNU_CONFIGURE=         yes
+
+RCD_SCRIPTS=           spawn-fcgi
+
+.include "../../mk/bsd.pkg.mk"
diff -r 658e34a254ed -r 9e28a9380af3 www/spawn-fcgi/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/spawn-fcgi/PLIST      Mon Feb 08 14:37:54 2010 +0000
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2010/02/08 14:37:54 joerg Exp $
+bin/spawn-fcgi
+man/man1/spawn-fcgi.1
+share/examples/rc.d/spawn-fcgi
diff -r 658e34a254ed -r 9e28a9380af3 www/spawn-fcgi/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/spawn-fcgi/distinfo   Mon Feb 08 14:37:54 2010 +0000
@@ -0,0 +1,5 @@
+$NetBSD: distinfo,v 1.1.1.1 2010/02/08 14:37:54 joerg Exp $
+
+SHA1 (spawn-fcgi-1.6.3.tar.gz) = 2b97ea57d9d79745fe8d6051d830fa507b421169
+RMD160 (spawn-fcgi-1.6.3.tar.gz) = 4c09fb3d8b03e17b491c733469570d538d3ff5ce
+Size (spawn-fcgi-1.6.3.tar.gz) = 97921 bytes
diff -r 658e34a254ed -r 9e28a9380af3 www/spawn-fcgi/files/spawnfcgi.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/spawn-fcgi/files/spawnfcgi.sh Mon Feb 08 14:37:54 2010 +0000
@@ -0,0 +1,128 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: spawnfcgi.sh,v 1.1.1.1 2010/02/08 14:37:54 joerg Exp $
+#
+# PROVIDE: spawnfcgi
+# BEFORE: apache cherokee lighttpd nginx
+# REQUIRE: DAEMON
+
+. /etc/rc.subr
+
+name="spawnfcgi"
+rcvar=$name
+command="@PREFIX@/bin/spawn-fcgi"
+start_cmd="spawnfcgi_start"
+stop_cmd="spawnfcgi_stop"
+status_cmd="spawnfcgi_status"
+pidfile_base="@VARBASE@/run/spawnfcgi-"
+
+spawnfcgi_pid()
+{
+       pidfile=${pidfile_base}$1
+       job_command=$(eval echo \$${name}_${job}_command)
+       rc_pid=`check_pidfile "$pidfile" $job_command`
+}
+
+spawnfcgi_start()
+{
+       rv=0
+       for job in "" $spawnfcgi_jobs; do
+               [ -z $job ] && continue
+               spawnfcgi_pid $job
+               if [ -n "${rc_pid}" ]; then
+                       echo "${name}/$job already running (pid=${rc_pid})."
+                       rv=1
+                       continue
+               fi
+               job_command=$(eval echo \$${name}_${job}_command)
+               job_args=$(eval echo \$${name}_${job}_args)
+               job_user=$(eval echo \$${name}_${job}_user)
+               job_cwd=$(eval echo \$${name}_${job}_cwd)
+               job_socket=$(eval echo \$${name}_${job}_socket)
+               job_socket_mode=$(eval echo \$${name}_${job}_socket_mode)
+               job_address=$(eval echo \$${name}_${job}_address)
+               job_children=$(eval echo \$${name}_${job}_children)
+               job_php_children=$(eval echo \$${name}_${job}_php_children)
+
+               if [ -n "${job_php_children}" ]; then
+                       opt_C="-C"
+               else
+                       opt_C=""
+               fi
+               if [ -n "${job_children}" ]; then
+                       opt_F="-F"
+               else
+                       opt_F=""
+               fi
+               if [ -n "${job_socket_mode}" ]; then
+                       opt_m="-m"
+               else
+                       opt_m=""
+               fi
+               if [ -n "${job_socket}" ]; then
+                       opt_s="-s"
+               else
+                       opt_s=""
+               fi
+               if [ -n "${job_address}" ]; then
+                       opt_a="-a"
+               else
+                       opt_a=""
+               fi
+               if [ -n "${job_port}" ]; then
+                       opt_p="-p"
+               else
+                       opt_p=""
+               fi
+               echo "Starting ${name}/$job."
+               $command -f ${job_command} \
+                   -u ${job_user} \
+                   -d ${job_cwd:-/} \
+                   $opt_C ${job_php_children} \
+                   $opt_F ${job_children} \
+                   $opt_s ${job_socket} \
+                   $opt_m ${job_socket_mode} \
+                   $opt_a ${job_address} \
+                   $opt_p ${job_port} \
+                   -P ${pidfile_base}${job} -- \
+                   ${job_command} ${job_args}
+       done
+       return $rv
+}
+
+spawnfcgi_stop()
+{
+       rv=0
+       for job in "" $spawnfcgi_jobs; do
+               [ -z $job ] && continue
+               spawnfcgi_pid $job
+               if [ -n "${rc_pid}" ]; then
+                       echo "Stopping ${name}/$job."
+                       kill -TERM ${rc_pid}
+                       wait_for_pids ${rc_pid}
+               else
+                       echo "${name}/$job is not running."
+                       rv=1
+               fi
+       done
+       return $rv
+}
+
+spawnfcgi_status()
+{
+       rv=0
+       for job in "" $spawnfcgi_jobs; do
+               [ -z $job ] && continue
+               spawnfcgi_pid $job
+               if [ -n "${rc_pid}" ]; then
+                       echo "${name}/${job} is running as pid ${rc_pid}."
+               else
+                       echo "${name}/${job} is not running."
+                       rv=1
+               fi
+       done
+       return $rv
+}
+
+load_rc_config $name
+run_rc_command $1



Home | Main Index | Thread Index | Old Index