#!/usr/bin/perl
# $Id: lonmemcached,v 1.8 2025/04/27 22:15:30 raeburn Exp $
$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);
my @args = ('-m','400','-l','127.0.0.1','-p','11211','-U','0','-v');
if (-e '/usr/sbin/memcached') {
unshift(@args,'/usr/sbin/memcached');
exec( { $args[0] } @args);
} elsif (-e '/usr/bin/memcached') {
unshift(@args,'/usr/bin/memcached');
exec( { $args[0] } @args);
} else {
die("Unable to find memcached");
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>