[LON-CAPA-cvs] cvs: loncom / loncron lonmemcached /init.d loncontrol

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 14 Feb 2005 00:29:49 -0000


albertel		Sun Feb 13 19:29:49 2005 EDT

  Added files:                 
    /loncom	lonmemcached 

  Modified files:              
    /loncom	loncron 
    /loncom/init.d	loncontrol 
  Log:
  - adding memcached as a daemon we need to start up
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.56 loncom/loncron:1.57
--- loncom/loncron:1.56	Wed Feb  9 15:41:29 2005
+++ loncom/loncron	Sun Feb 13 19:29:48 2005
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.56 2005/02/09 20:41:29 albertel Exp $
+# $Id: loncron,v 1.57 2005/02/14 00:29:48 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -114,7 +114,7 @@
     my ($fh,$daemon,$maxsize,$sendusr1,$args)=@_;
 
     &log($fh,'<hr /><a name="'.$daemon.'" /><h2>'.$daemon.'</h2><h3>Log</h3><p style="white-space: pre;"><tt>');
-    printf("%-10s ",$daemon);
+    printf("%-15s ",$daemon);
     if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){
 	open (DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|");
 	while (my $line=<DFH>) { 
@@ -152,11 +152,13 @@
     if ($restartflag==1) {
 	$simplestatus{$daemon}='off';
 	$errors++;
+	my $kadaemon=$daemon;
+	if ($kadaemon eq 'lonmemcached') { $kadaemon='memcached'; }
 	&log($fh,'<br><font color="red">Killall '.$daemon.': '.
-	    `killall $daemon 2>&1`.' - ');
+	    `killall $kadaemon 2>&1`.' - ');
 	sleep 2;
 	&log($fh,unlink($pidfile).' - '.
-	    `killall -9 $daemon 2>&1`.
+	    `killall -9 $kadaemon 2>&1`.
 	    '</font><br>');
 	&log($fh,"<h3>$daemon not running, trying to start</h3>");
 	
@@ -678,6 +680,7 @@
 	if ($oldlonc) { $args = ''; }
 	&checkon_daemon($fh,'lonc',40000,1,$args);
 	&checkon_daemon($fh,'lonhttpd',40000);
+	&checkon_daemon($fh,'lonmemcached',40000);
     }
     if (!$justcheckdaemons) {
 	&test_connections($fh,\%hostname);
Index: loncom/init.d/loncontrol
diff -u loncom/init.d/loncontrol:1.23 loncom/init.d/loncontrol:1.24
--- loncom/init.d/loncontrol:1.23	Mon Dec 20 09:28:56 2004
+++ loncom/init.d/loncontrol	Sun Feb 13 19:29:48 2005
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: loncontrol,v 1.23 2004/12/20 14:28:56 matthew Exp $
+# $Id: loncontrol,v 1.24 2005/02/14 00:29:48 albertel Exp $
 #
 # The LearningOnline Network with CAPA
 #
@@ -122,7 +122,7 @@
     my ($daemon,$killallname)=@_;
     my $pidfile="/home/httpd/perl/logs/$daemon.pid";
     
-    printf("%-10s ",$daemon);
+    printf("%-15s ",$daemon);
     if (-e $pidfile) {
 	open(PIDFILE,$pidfile);
 	my $daemonpid=<PIDFILE>;
@@ -148,6 +148,7 @@
 	system("killall -q $killallname");
 	print(", killed off extraneous processes");
     }
+    unlink($pidfile);
     print("\n");
 }
 
@@ -155,7 +156,7 @@
 if (($command eq "restartold") or ($command eq "reloadold")) {
     print 'Restarting LON-CAPA'."\n";
     print 'Ending LON-CAPA client and daemon processes'."\n";
-    foreach my $daemon ('lonsql','lond','lonc','lonhttpd') {
+    foreach my $daemon ('lonsql','lond','lonc','lonhttpd','lonmemcached') {
 	&stop_daemon($daemon,$daemon);
     }
     print 'Starting LON-CAPA client and daemon processes (please be patient)'.
@@ -164,7 +165,7 @@
 } elsif (($command eq "restart") or ($command eq "reload")) {
     print 'Restarting LON-CAPA'."\n";
     print 'Ending LON-CAPA client and daemon processes'."\n";
-    foreach my $daemon ('lonsql','lond','lonc','lonhttpd') {
+    foreach my $daemon ('lonsql','lond','lonc','lonhttpd','lonmemcached') {
 	my $killallname=$daemon;
 	if ($daemon eq 'lonc') { $killallname='loncnew'; }
 	&stop_daemon($daemon,$killallname);
@@ -174,7 +175,7 @@
     system("su www -c '/home/httpd/perl/loncron --justcheckdaemons'");
 } elsif ($command eq "stop") {
     print 'Stopping LON-CAPA'."\n";
-    foreach my $daemon ('lonsql','lond','lonc','lonhttpd') {
+    foreach my $daemon ('lonsql','lond','lonc','lonhttpd','lonmemcached') {
 	my $killallname=$daemon;
 	if ($daemon eq 'lonc') { $killallname='loncnew'; }
 	&stop_daemon($daemon,$killallname);