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