Skip to content

Instantly share code, notes, and snippets.

@tsertkov
Last active December 22, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsertkov/6494295 to your computer and use it in GitHub Desktop.
Save tsertkov/6494295 to your computer and use it in GitHub Desktop.
Daemontools (http://cr.yp.to/daemontools.html) run script for starting apache. Service directory basename is passed to apache via -D command line option and can be checked with <IfDefine>. For example for the script located at "/etc/service/php55/run" "php55" is defined with -D.
#!/bin/bash
SNAME=${PWD%/*}
SNAME=${SNAME##*/}
exec 2>&1
exec \
env -i PATH=/bin:/usr/bin PHPRC=/opt/apache-dev/servers/$SNAME \
setuidgid www-dev \
/opt/apache-dev/bin/httpd -D FOREGROUND -D $SNAME
<IfDefine php54>
LoadModule php5_module modules/libphp54.so
Listen 8081
ServerRoot /opt/apache-dev/servers/php54
</IfDefine>
<IfDefine php55>
LoadModule php5_module modules/libphp55.so
Listen 8082
ServerRoot /opt/apache-dev/servers/php55
</IfDefine>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment