まずは、玄箱をWEBサーバにしてみましょう。 でも、WEBサーバのプログラムをインストールなんて、したくないな。
root@NORITAN-BOX:/etc# cat /etc/thttpd.conf dir=/www user=root logfile=/var/log/thttpd.log pidfile=/var/run/thttpd.pid port=80 charset="" cgipat=/cgi-bin*/*
root@NORITAN-BOX:/etc# cat /etc/thttpd2.conf dir=/mnt/www user=noritan logfile=/var/log/thttpd2.log pidfile=/var/run/thttpd2.pid port=8080 charset="" cgipat=/cgi-bin*/*
root@NORITAN-BOX:/etc# cat /etc/init.d/thttpd
#!/bin/sh
#
# thttpd - startup script for thttpd
# This goes in /etc/init.d and gets run at boot-time.
#
# chkconfig 2345 20 20
#
. /etc/timezone
PATH=/bin:/usr/bin:/sbin:/usr/sbin
if ! [ -x /usr/sbin/thttpd ]; then
exit 0
fi
case "$1" in
start)
if [ -x /usr/sbin/thttpd ] ; then
echo "Start services: thttpd"
/usr/sbin/thttpd -C /etc/thttpd.conf
/usr/sbin/thttpd -C /etc/thttpd2.conf
fi
;;
stop)
echo "Stop services: thttpd"
/sbin/start-stop-daemon --stop --quiet --exec /usr/sbin/thttpd
;;
restart)
echo "Restart services: thttpd"
/sbin/start-stop-daemon --stop --quiet --exec /usr/sbin/thttpd
sleep 1
/usr/sbin/thttpd -C /etc/thttpd.conf
/usr/sbin/thttpd -C /etc/thttpd2.conf
;;
*)
echo "usage: $0 { start | stop | restart}" >&2
exit 1
;;
esac
exit 0
root@NORITAN-BOX:/etc# cat /etc/cron.daily/logrotate
#!/bin/sh
/usr/sbin/logrotate /etc/logrotate.conf
root@NORITAN-BOX:/etc# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
daily
# keep 4 days worth of backlogs
rotate 3
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
compress
include /etc/logrotate.d
root@NORITAN-BOX:/etc# ls /etc/logrotate.d
samba syslog thttpd thttpd2 wu-ftpd
root@NORITAN-BOX:/etc# cat /etc/logrotate.d/thttpd
/var/log/thttpd.log {
missingok
postrotate
/sbin/killall -s HUP thttpd
endscript
}
root@NORITAN-BOX:/etc# cat /etc/logrotate.d/thttpd2
/var/log/thttpd2.log {
missingok
postrotate
/sbin/killall -s HUP thttpd
endscript
}
Updated: $Date: 2007/01/22 12:47:16 $
Copyright (C) 2006 noritan.org ■