Actions
Example fastcgiCentosInitScript » History » Revision 1
Revision 1/4
| Next »
EricIsGood, 2008-10-25 05:26
Here's an example of starting fastcgi with an init script on CentOS. I couldn't find another example of this, and it took me a while to hack one together from other init script and fcgi examples, hope it helps.
#!/bin/sh # # fcgi Startup script for fcgi # # processname: fcgi # Source function library . /etc/rc.d/init.d/functions FCGI_DAEMON="/usr/local/bin/spawn-fcgi" FCGI_PROGRAM="/usr/local/bin/php-cgi" FCGI_SOCKET="/tmp/php-fastcgi.sock" FCGI_PIDFILE="/var/run/spawn-fcgi.pid" PHP_FCGI_CHILDREN=4 PHP_FCGI_MAX_REQUESTS=1000 prog="fcgi" RETVAL=0 start() { echo -n $"Starting $prog: " daemon $FCGI_DAEMON -f $FCGI_PROGRAM -s $FCGI_SOCKET -P $FCGI_PIDFILE RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog return $RETVAL } stop() { echo -n $"Stopping $prog: " rm -f $FCGI_PIDFILE $FCGI_SOCKET killproc $FCGI_PROGRAM RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; condrestart) if [ -f /var/lock/subsys/$prog ]; then stop start fi ;; status) status $lighttpd RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" RETVAL=1 esac exit $RETVAL
Updated by EricIsGood about 16 years ago · 1 revisions