File:  [LON-CAPA] / loncom / lonmemcached
Revision 1.5: download - view: text, annotated - select for diffs
Fri Jul 8 02:22:58 2005 UTC (17 years, 3 months ago) by albertel
Branches: MAIN
CVS tags: version_2_2_X, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_1_3, version_2_1_2, version_2_1_1, version_2_1_0, version_2_0_X, version_2_0_99_1, version_2_0_2, version_2_0_1, version_2_0_0, version_1_99_3, version_1_99_2, HEAD
- typo

#!/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/bin/memcached','-m','256','-v');
} else {
    die("Unable to find memcached");
}

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