#!/usr/bin/perl -s
$V = "0.01";

use sigtrap 'handler', \&DIE;
$SIG{__DIE__} = \&DIE;
$SIG{HUP}     = \&HUP;

#Here to allow redefinition by user
sub lt {
    return scalar localtime(time); }


if( $d ){
    open(DEBUG, ($d != 1 ? $d : ">/dev/tty8"));
    printf DEBUG "[%s] [notice] clogger $V($$)", &lt; }
print DEBUG " configured -- resuming normal operations\n" if init() && $d;
while(<STDIN>){
    print DEBUG if $d;
    &log(); }


sub init {
    do $c;
    foreach ( keys %FILES ){
	if( $_ eq "DEBUG" ){
	    printf DEBUG "[%s] [notice] DEBUG is a reserved handle. Skipping $FILE{$_}->[0]", &lt if $d;
	    next; }
	open($_, $FILES{$_}->[0]);
	if( $FILE{$_}->[1] ){
	    select($_);
	    $|=1 };
    }
    select(STDOUT); }
sub HUP {
    map( close($_), keys %FILE);
    printf DEBUG "[%s] [notice] SIG%s received.  Attempting to restart($$)\n", &lt, shift() if $d;
    init(); }
sub DIE{
    map( close($_), keys %FILE);
    printf DEBUG "[%s] [notice] SIG%s received.  Attempting to die($$)\n", &lt, shift() if $d;
    exit 0; }

__DATA__
-u & -g options to setuid and setgid !! :-) better security...
ESP. if multi vhosts with multi flog processes
