Re: logrotate and more...

2003-04-05 Thread Thomas E. Horner
At 20:40 04.04.2003, you wrote:
do you want to make the changes that michiel recommended?
no, cause the scripts runs perfect now for about two years.
restarting always works.
what michiel probably didn't see was that you should normally
use the 'safe-restart' and 'safe-stop' options and not the 'restart'
and 'stop' options.
i wrote start, stop and restart first, before reading the full source
of mathopd. after discovering mathopds reaction souce code on
signals (which is nowhere documented!!) i wrote the remaining
options.
and about log-rotation:
see it as an addon. i can mathopd make reopen the log whenever
i like to.
if so, i'll wait to put it on the mathopd how-to i wrote.
if not, i'll put it up now.
--
mattg - [EMAIL PROTECTED]
[hello to all my fans in domestic surveillance]
Thomas E. Horner wrote:
on your site http://apathy.guiltyparty.org/u/doc/mathopd/
i found the following:
if you use logrotate to manage /var/log, create a file called "mathopd" 
in /etc/logrotate.d/ and insert this:
/var/log/mathopd/log.* {
weekly
missingok
rotate 7
compress
create 640 daemon daemon
sharedscripts
postrotate
killall mathopd
sleep 5
/usr/local/sbin/mathopd < /etc/mathopd.conf
endscript
}

which kills mathopd.
that's bad housekeeping and unnessacary.
see the attached file (an init-script) i wrote.
option 'force-nextlog' reopens the log, which is
given by
Log /var/mathopd/log/%Y-%m-%d
in mathopd.conf.
at 00:00:00 daily cron executes the script
/etc/init.d/mathopd force-nextlog
so i get a daily log without any extra program.
it was originally written for suse linux and
it needs some customizing but can do a great job.
you can put it on your web-page if you'd like to.




Re: logrotate and more...

2003-04-04 Thread mattg
do you want to make the changes that michiel recommended?
if so, i'll wait to put it on the mathopd how-to i wrote.
if not, i'll put it up now.
--
mattg - [EMAIL PROTECTED]
[hello to all my fans in domestic surveillance]
Thomas E. Horner wrote:
on your site http://apathy.guiltyparty.org/u/doc/mathopd/
i found the following:
if you use logrotate to manage /var/log, create a file called "mathopd" 
in /etc/logrotate.d/ and insert this:
/var/log/mathopd/log.* {
weekly
missingok
rotate 7
compress
create 640 daemon daemon
sharedscripts
postrotate
killall mathopd
sleep 5
/usr/local/sbin/mathopd < /etc/mathopd.conf
endscript
}



which kills mathopd.
that's bad housekeeping and unnessacary.
see the attached file (an init-script) i wrote.

option 'force-nextlog' reopens the log, which is
given by
Log /var/mathopd/log/%Y-%m-%d
in mathopd.conf.
at 00:00:00 daily cron executes the script
/etc/init.d/mathopd force-nextlog
so i get a daily log without any extra program.
it was originally written for suse linux and
it needs some customizing but can do a great job.
you can put it on your web-page if you'd like to.



Re: logrotate and more...

2003-04-04 Thread Michiel Boland
> killall mathopd
> sleep 5
> /usr/local/sbin/mathopd < /etc/mathopd.conf
> endscript
> }
>
>
>
> which kills mathopd.

What one could do is kill mathopd with SIGUSR2, which should cause a
silent and graceful death, but which leaves a window of time (5 seconds)
during which no server runs.

> see the attached file (an init-script) i wrote.
>
> option 'force-nextlog' reopens the log, which is
> given by
>   Log /var/mathopd/log/%Y-%m-%d
> in mathopd.conf.
>
> at 00:00:00 daily cron executes the script
>   /etc/init.d/mathopd force-nextlog
> so i get a daily log without any extra program.

Actually you do not even need to do this with mathopd 1.4. It will reopen
the log file automatically every hour.

Cheers
Michiel



logrotate and more...

2003-04-03 Thread Thomas E. Horner
on your site http://apathy.guiltyparty.org/u/doc/mathopd/
i found the following:
if you use logrotate to manage /var/log, create a file called "mathopd" in 
/etc/logrotate.d/ and insert this:
/var/log/mathopd/log.* {
weekly
missingok
rotate 7
compress
create 640 daemon daemon
sharedscripts
postrotate
killall mathopd
sleep 5
/usr/local/sbin/mathopd < /etc/mathopd.conf
endscript
}



which kills mathopd.
that's bad housekeeping and unnessacary.
see the attached file (an init-script) i wrote.

option 'force-nextlog' reopens the log, which is
given by
Log /var/mathopd/log/%Y-%m-%d
in mathopd.conf.
at 00:00:00 daily cron executes the script
/etc/init.d/mathopd force-nextlog
so i get a daily log without any extra program.
it was originally written for suse linux and
it needs some customizing but can do a great job.
you can put it on your web-page if you'd like to.#!/bin/sh
# init.d script for mathopd. Set the variables below to something fitting..
# This is only an example script.
#

# The name of the executeable.
#
mathopdexec=mathopd

# The server directory where the executable is located.
#
mathopdhome=/usr/local/sbin/

# Set this to something unique to be able to stop, reload and restart
# with this init script. It will override the setting in the config
# interface. '0' is typically replaced with the uid.
#
pidfile=/var/mathopd/pid

# Set these to kill all processes owned by wwwuser on stop. Useful to
# reap CGI scripts.
#
# killallwww=yes
# wwwuser=www

umask 022

# If you want to start with another configuration directory:
#
# configdir=dirname

# Insert the name of the Configuration-File here
# 
configfile=mathopd.conf

### You should not _have_ to change anything below here...

case $1 in
'start')
echo "Starting mathopd from $mathopdhome..."
if [ -z "$pidfile" ]; then
echo "Warning: No pid file set - cannot stop or reload."
elif [ -f "$pidfile" ]; then
read pid < $pidfile
if kill -0 $pid ; then
echo "mathopd is already running."
exit 0
fi
rm -f $pidfile
if [ -f "$pidfile" ]; then
echo Cannot remove pid file $pidfile
exit 1
fi
fi
if [ -x "$mathopdhome/$mathopdexec" ]; then
cd $mathopdhome
./$mathopdexec < $configfile 2>/dev/null
echo "Done."
else
echo "I cannot find the mathopd dir '('$mathopdhome')'"
fi
;;

'restart')
if [ -z "$pidfile" ] ; then
echo "No pid file set."
exit 1
fi
echo Restarting mathopd...
if [ -f "$pidfile" ] ; then
read pid < $pidfile
kill -INT $pid || kill 2 $pid
rm "$pidfile"
echo "Stopping mathopd..."
else
echo "mathopd doesn't seem to be running."
fi
echo Starting a new mathopd in $mathopdhome...
if [ -x "$mathopdhome/$mathopdexec" ]; then
cd $mathopdhome
./$mathopdexec < $configfile 2>/dev/null
else
echo "I cannot find the mathopd dir '('$mathopdhome')'"
fi
echo "Done."
;;

'stop')
if [ -z "$pidfile" ] ; then
echo "No pid file set."
exit 1
fi
echo "Stopping mathopd..."
if [ -f $pidfile ] ; then
if kill `cat $pidfile` ; then
echo mathopd stopped.
fi
rm $pidfile
else
echo "mathopd doesn't seem to be running."
fi
# Get all the CGI scripts... :-)
if [ x$killallwww = xyes ] ; then
echo Killing all programs running as the $wwwuser user.
su $wwwuser -c "kill -9 -1"
fi
;;

'force-nextlog')
# send HUP (=1)
/sbin/killproc -1 "$mathopdhome/$mathopdexec"
echo "logs reopened."
;;

'kill-connections')
# send USR1 (=10)
/sbin/killproc -10 "$mathopdhome/$mathopdexec"
echo "all connections killed."
;;

'safe-stop')
# send USR2 (=12)
/sbin/killproc -12 "$mathopdhome/$mathopdexec"