Annotation of loncom/lonmemcached, revision 1.7

1.1       albertel    1: #!/usr/bin/perl
1.7     ! albertel    2: # $Id: lond,v 1.378 2007/08/08 22:24:36 albertel Exp $
        !             3: 
1.1       albertel    4: $pidfile="/home/httpd/perl/logs/lonmemcached.pid";
                      5: $logfile="/home/httpd/perl/logs/lonmemcached.log";
                      6: 
                      7: if (-e $pidfile) {
                      8:    open(LFH,"$pidfile");
                      9:    my $pide=<LFH>;
                     10:    chomp($pide);
                     11:    close(LFH);
                     12:    if (kill 0 => $pide) { die "already running $pide"; }
                     13: }
                     14: 
                     15: if ($pid=fork()) { exit; }
                     16: open (PIDSAVE,">$pidfile");
                     17: print PIDSAVE "$$\n";
                     18: close(PIDSAVE);
                     19: 
1.4       albertel   20: if (-e '/usr/sbin/memcached') {
1.6       albertel   21:     exec('/usr/sbin/memcached','-m','400','-v');
1.4       albertel   22: } elsif (-e '/usr/bin/memcached') {
1.6       albertel   23:     exec('/usr/bin/memcached','-m','400','-v');
1.4       albertel   24: } else {
                     25:     die("Unable to find memcached");
                     26: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>