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

    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: 
   18: if (-e '/usr/sbin/memcached') {
   19:     exec('/usr/sbin/memcached','-m','256','-v');
   20: } elsif (-e '/usr/bin/memcached') {
   21:     exec('/usr/sbin/memcached','-m','256','-v');
   22: } else {
   23:     die("Unable to find memcached");
   24: }

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