Next Trivial Utilities 98

printd

        use strict;
        use Sys::Syslog;
        use Fcntl ':flock';
        use lib '/home/mjd/lib';
        use MJD::Print;
        my %CONF = load_conf($CONFIG);
        my $NEXTOP = 0;
        open STDERR, ">>", '/tmp/printd.err' if $CONF{debug_printd};
        print STDERR "printd $$ running\n" if $CONF{debug_printd};
        close STDOUT;
        chdir $CONF{spooldir} 
          or die "Couldn't chdir to spool directory $CONF{spooldir}: $!; aborting";
        open D, "." or die "Couldn't open .: $!; aborting";
        flock D, LOCK_EX | LOCK_NB 
          or exit 0;
        print STDERR "Got lock.\n" if $CONF{debug_printd};
        mainloop();


Next Menu Copyright © 2012 M. J. Dominus