version 1.37, 2009/06/10 23:51:46
|
version 1.45, 2018/08/07 17:12:17
|
Line 40
|
Line 40
|
# SuSE chkconfig/insserv info |
# SuSE chkconfig/insserv info |
### BEGIN INIT INFO |
### BEGIN INIT INFO |
# Provides: loncapa |
# Provides: loncapa |
# Required-Start: mysql apache2 $network $remote_fs |
# Required-Start: SuSEfirewall2_setup mysql apache2 $network $remote_fs |
|
# Should-Start: $ALL |
# Required-Stop: |
# Required-Stop: |
# Default-Start: 3 4 5 |
# Default-Start: 3 5 |
# Default-Stop: |
# Default-Stop: |
# Description: Starts the LON-CAPA services |
# Description: Starts the LON-CAPA services |
### END INIT INFO |
### END INIT INFO |
Line 92 sub stop_daemon {
|
Line 93 sub stop_daemon {
|
print(", killed off extraneous processes"); |
print(", killed off extraneous processes"); |
} |
} |
unlink($pidfile); |
unlink($pidfile); |
|
if ($killallname eq 'loncnew') { |
|
&clean_nossl_loncpids(); |
|
} |
print("\n"); |
print("\n"); |
} |
} |
|
|
Line 106 sub clean_sockets {
|
Line 110 sub clean_sockets {
|
} |
} |
} |
} |
|
|
if ($command eq "restart") { |
sub clean_nossl_loncpids { |
print 'Restarting LON-CAPA'."\n"; |
my $childpiddir = '/home/httpd/perl/logs/loncpids'; |
print 'Ending LON-CAPA client and daemon processes'."\n"; |
my $nossldir = '/home/httpd/sockets/nosslverify'; |
foreach my $daemon ('lonsql','lond','lonc','lonmemcached','lonmaxima','lonr') { |
foreach my $dir ($childpiddir,$nossldir) { |
my $killallname=$daemon; |
if (-d $dir) { |
if ($daemon eq 'lonc') { $killallname='loncnew'; } |
if (opendir(my $dh,$dir)) { |
&stop_daemon($daemon,$killallname); |
while (my $fname=readdir($dh)) { |
|
next if ($fname =~ /^\./); |
|
unlink("$dir/$fname"); |
|
} |
|
closedir($dh); |
|
} |
|
} |
} |
} |
print 'Starting LON-CAPA client and daemon processes (please be patient)'. |
} |
"\n"; |
|
system("su www -c '/home/httpd/perl/loncron --justcheckdaemons'"); |
if (($command eq "restart") || ($command eq 'stop') || |
} elsif (($command eq "stop") || ($command eq 'start') || ($command eq 'status')) { |
($command eq 'start') || ($command eq "status")) { |
my $iptables = &LONCAPA::Firewall::get_pathto_iptables(); |
my $iptables = &LONCAPA::Firewall::get_pathto_iptables(); |
my $fw_chain = &LONCAPA::Firewall::get_fw_chain(); |
my @fw_chains = &LONCAPA::Firewall::get_fw_chains($iptables); |
my $lond_port = &LONCAPA::Firewall::get_lond_port(); |
my $lond_port = &LONCAPA::Firewall::get_lond_port(); |
my %iphost = &Apache::lonnet::get_iphost(); |
my %iphost; |
if ($command eq 'stop') { |
if ($command eq 'restart') { |
|
print 'Restarting LON-CAPA'."\n"; |
|
print 'Ending LON-CAPA client and daemon processes'."\n"; |
|
foreach my $daemon ('lonsql','lond','lonc','lonmemcached','lonmaxima','lonr') { |
|
my $killallname=$daemon; |
|
if ($daemon eq 'lonc') { $killallname='loncnew'; } |
|
&stop_daemon($daemon,$killallname); |
|
} |
|
%iphost = &Apache::lonnet::get_iphost('',1); |
|
my $firewall_result = |
|
&LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains, |
|
$lond_port,\%iphost,[$lond_port]); |
|
if ($firewall_result) { |
|
print "$firewall_result\n"; |
|
} |
|
$firewall_result = |
|
&LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains, |
|
$lond_port, \%iphost,[$lond_port]); |
|
if (($firewall_result eq 'ok') || ($firewall_result eq 'inactive firewall')) { |
|
if ($firewall_result eq 'inactive firewall') { |
|
print "WARNING: iptables firewall is currently inactive\n"; |
|
} |
|
} elsif ($firewall_result) { |
|
print "$firewall_result\n"; |
|
} |
|
print 'Starting LON-CAPA client and daemon processes (please be patient)'. |
|
"\n"; |
|
system("su www -c '/home/httpd/perl/loncron --justcheckdaemons'"); |
|
} elsif ($command eq 'stop') { |
print 'Stopping LON-CAPA'."\n"; |
print 'Stopping LON-CAPA'."\n"; |
foreach my $daemon ('lonsql','lond','lonc','lonmemcached','lonmaxima','lonr') { |
foreach my $daemon ('lonsql','lond','lonc','lonmemcached','lonmaxima','lonr') { |
my $killallname=$daemon; |
my $killallname=$daemon; |
Line 130 if ($command eq "restart") {
|
Line 168 if ($command eq "restart") {
|
&stop_daemon($daemon,$killallname); |
&stop_daemon($daemon,$killallname); |
} |
} |
my $firewall_result = |
my $firewall_result = |
&LONCAPA::Firewall::firewall_close_port($iptables,$fw_chain,$lond_port,[$lond_port]); |
&LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port]); |
if ($firewall_result) { |
if ($firewall_result) { |
print "$firewall_result\n"; |
print "$firewall_result\n"; |
} |
} |
&clean_sockets(); |
&clean_sockets(); |
} elsif ($command eq "start") { |
} elsif ($command eq "start") { |
|
%iphost = &Apache::lonnet::get_iphost('',1); |
my $firewall_result = |
my $firewall_result = |
&LONCAPA::Firewall::firewall_open_port($iptables,$fw_chain,$lond_port,\%iphost,[$lond_port]); |
&LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port]); |
if (($firewall_result eq 'ok') || ($firewall_result eq 'inactive firewall')) { |
if (($firewall_result eq 'ok') || ($firewall_result eq 'inactive firewall')) { |
if ($firewall_result eq 'inactive firewall') { |
if ($firewall_result eq 'inactive firewall') { |
print "WARNING: iptables firewall is currently inactive\n"; |
print "WARNING: iptables firewall is currently inactive\n"; |
Line 155 if ($command eq "restart") {
|
Line 194 if ($command eq "restart") {
|
} |
} |
} |
} |
} elsif ($command eq "status") { |
} elsif ($command eq "status") { |
|
%iphost = &Apache::lonnet::get_iphost(); |
my $response=`/bin/cat /home/httpd/perl/logs/*.pid 2>&1`; |
my $response=`/bin/cat /home/httpd/perl/logs/*.pid 2>&1`; |
if ($response=~/No such file or directory/) { |
if ($response=~/No such file or directory/) { |
print 'LON-CAPA is not running.'."\n"; |
print 'LON-CAPA is not running.'."\n"; |
Line 166 if ($command eq "restart") {
|
Line 206 if ($command eq "restart") {
|
print 'The iptables firewall is not active'."\n"; |
print 'The iptables firewall is not active'."\n"; |
} |
} |
if ($lond_port) { |
if ($lond_port) { |
if (&LONCAPA::Firewall::firewall_is_port_open($iptables,$fw_chain,$lond_port,$lond_port,\%iphost)) { |
my $londopen; |
|
foreach my $fw_chain (@fw_chains) { |
|
my $numopen = &LONCAPA::Firewall::firewall_is_port_open($iptables,$fw_chain,$lond_port,$lond_port,\%iphost); |
|
$londopen += $numopen; |
|
} |
|
if ($londopen) { |
print "The LON-CAPA port ($lond_port) is open in firewall.\n"; |
print "The LON-CAPA port ($lond_port) is open in firewall.\n"; |
} elsif (&LONCAPA::Firewall::firewall_is_active) { |
} elsif (&LONCAPA::Firewall::firewall_is_active) { |
print "The LON-CAPA port ($lond_port) is NOT open in running firewall!\n"; |
print "The LON-CAPA port ($lond_port) is NOT open in running firewall!\n"; |