--- loncom/init.d/loncontrol 2007/06/02 03:40:02 1.31 +++ loncom/init.d/loncontrol 2008/11/04 21:06:31 1.33 @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# $Id: loncontrol,v 1.31 2007/06/02 03:40:02 albertel Exp $ +# $Id: loncontrol,v 1.33 2008/11/04 21:06:31 www Exp $ # # The LearningOnline Network with CAPA # @@ -64,7 +64,6 @@ $ENV{'BASH_ENV'}=""; } } my $lond_port = 5663; - my $lonhttpd_port = 8080; sub firewall_open_port { return if (! &firewall_is_active); @@ -74,7 +73,7 @@ sub firewall_open_port { # We could restrict the servers allowed to attempt to communicate # here, but the logistics of updating the /home/httpd/lonTabs/host.tab # file are likely to be a problem - foreach my $port ($lond_port,$lonhttpd_port) { + foreach my $port ($lond_port) { print "Opening firewall access on port $port.\n"; my $firewall_command = @@ -115,7 +114,7 @@ sub firewall_is_active { sub firewall_close_port { return if (! &firewall_is_active); - foreach my $port ($lond_port,$lonhttpd_port) { + foreach my $port ($lond_port) { print "Closing firewall access on port $port.\n"; my $firewall_command = "$iptables -D $fw_chain -p tcp -d 0/0 --dport $port -j ACCEPT"; @@ -144,7 +143,10 @@ sub stop_daemon { my $daemonpid=; chomp($daemonpid); kill TERM => $daemonpid; - sleep 1; + my $count=0; + while ($count++ < 5 && kill(0 => $daemonpid)) { + sleep 1; + } if (kill 0 => $daemonpid) { kill KILL => $daemonpid; sleep 1; @@ -180,7 +182,7 @@ sub clean_sockets { if ($command eq "restart") { print 'Restarting LON-CAPA'."\n"; print 'Ending LON-CAPA client and daemon processes'."\n"; - foreach my $daemon ('lonsql','lond','lonc','lonhttpd','lonmemcached','lonmaxima') { + foreach my $daemon ('lonsql','lond','lonc','lonmemcached','lonmaxima') { my $killallname=$daemon; if ($daemon eq 'lonc') { $killallname='loncnew'; } &stop_daemon($daemon,$killallname); @@ -190,7 +192,7 @@ if ($command eq "restart") { 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','lonmemcached','lonmaxima') { + foreach my $daemon ('lonsql','lond','lonc','lonmemcached','lonmaxima') { my $killallname=$daemon; if ($daemon eq 'lonc') { $killallname='loncnew'; } &stop_daemon($daemon,$killallname);