Annotation of loncom/lonmemcached, revision 1.5

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

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