File:  [LON-CAPA] / loncom / lonmemcached
Revision 1.4: download - view: text, annotated - select for diffs
Fri Jul 8 01:23:29 2005 UTC (17 years, 1 month ago) by albertel
Branches: MAIN
CVS tags: HEAD
- SuSE puts memcached into /usr/bin

#!/usr/bin/perl
$pidfile="/home/httpd/perl/logs/lonmemcached.pid";
$logfile="/home/httpd/perl/logs/lonmemcached.log";

if (-e $pidfile) {
   open(LFH,"$pidfile");
   my $pide=<LFH>;
   chomp($pide);
   close(LFH);
   if (kill 0 => $pide) { die "already running $pide"; }
}

if ($pid=fork()) { exit; }
open (PIDSAVE,">$pidfile");
print PIDSAVE "$$\n";
close(PIDSAVE);

if (-e '/usr/sbin/memcached') {
    exec('/usr/sbin/memcached','-m','256','-v');
} elsif (-e '/usr/bin/memcached') {
    exec('/usr/sbin/memcached','-m','256','-v');
} else {
    die("Unable to find memcached");
}

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