106 번 글: [apache] apache_wrapper |
글쓴이: 산이
[홈페이지]
|
글쓴날: 2004년 12월 04일 02:41:18 토(새벽) |
조회: 3490 |
-- /usr/local/sbin/apache_wrapper --------------------------
#!/bin/sh
#
# -- apache `httpd' wrapper
# -- /usr/local/sbin/apache_wrapper
# -- san2@2004.12.04
#
rm_file()
{
rm -f $PPIDFILE
}
trap 'rm_file; exit 0' 1 2 5 9 19
HTTPD=`which httpd 2>/dev/null`
PPIDFILE=/var/run/apache_wrapper.pid
USER=$2
[ X"$HTTPD" = "X" ] && exit 1
[ X"$1" = X"-U" -a X"$USER" != "X" ] &&
HTTPD="/usr/bin/limits -U $USER $HTTPD"
echo $$ > $PPIDFILE
while [ 1 ] ; do
$HTTPD -F
killall httpd
sleep 10
date >> /var/log/apache_wrapper.log
done
exit 0
-----------------------------------------------------------
-- /path/to/rc.d/apache.sh --------------------------------
#!/bin/sh
case "$1" in
start)
if [ -x /usr/local/sbin/apache_wrapper ]; then
/usr/local/sbin/apache_wrapper -U www &
echo -n ' apache'
fi
;;
stop)
kill `cat /var/run/apache_wrapper.pid 2>/dev/null` 2>/dev/null \
&& killall httpd && echo -n ' apache'
rm -f /var/run/apache_wrapper.pid
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
;;
esac
exit 0
---------------------------------------------------------
|
이전글 : [PHP & SHELL] daemon mode -- background
다음글 : [PHP] socket() 관련 상수 및 에러
|
from 61.254.75.78
JS(Redhands)Board 0.4 +@
|