Annotation of loncom/init.d/loncontrol, revision 1.8

1.1       harris41    1: #!/usr/bin/perl
1.2       harris41    2: #
1.6       harris41    3: # The LearningOnline Network with CAPA
                      4: #
1.2       harris41    5: # Startup script for the LON-CAPA network processes
1.6       harris41    6: #
                      7: # YEAR=2000
                      8: # 10/25 Scott Harrison
                      9: # YEAR=2001
                     10: # 10/2 Scott Harrison
1.7       harris41   11: # YEAR=2002
                     12: # 5/11 Scott Harrison
                     13: 
1.3       harris41   14: # chkconfig: 345 95 5
1.6       harris41   15: # description: LON-CAPA is an knowledge network server.  It is used to
                     16: # distribute knowledge resources and instructional management.
1.2       harris41   17: # processnames: lonc, lond, lonsql
                     18: # pidfiles: /home/httpd/perl/logs/lon*.pid
1.7       harris41   19: # config: /etc/httpd/conf/loncapa.conf
1.2       harris41   20: # config: /home/httpd/lonTabs/hosts.tab
                     21: # config: /home/httpd/lonTabs/spare.tab
                     22: 
1.1       harris41   23: $command=$ARGV[0]; $command=~s/[^a-z]//g;
                     24: 
                     25: $ENV{'PATH'}="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin";
                     26: $ENV{'BASH_ENV'}="";
                     27: 
                     28: if (($command eq "restart") or ($command eq "reload")) {
1.6       harris41   29:     print 'Restarting LON-CAPA'."\n";
                     30:     print 'Ending LON-CAPA client and daemon processes'."\n";
1.3       harris41   31:     print `su -c '/bin/kill \`/bin/cat /home/httpd/perl/logs/*.pid\`' www`;
1.6       harris41   32:     print 'Starting LON-CAPA client and daemon processes (please be patient)'.
                     33: 	"\n";
                     34:     system("su -c '/home/httpd/perl/loncron' www");
1.1       harris41   35: }
                     36: elsif ($command eq "stop") {
1.6       harris41   37:     print 'Stopping LON-CAPA'."\n";
1.3       harris41   38:     print `su -c '/bin/kill \`/bin/cat /home/httpd/perl/logs/*.pid\`' www`;
1.1       harris41   39: }
                     40: elsif ($command eq "start") {
1.6       harris41   41:     print 'Starting LON-CAPA'."\n";
                     42:     print 'Starting LON-CAPA client and daemon processes (please be patient)'.
                     43: 	"\n"; 
                     44:     system("su -c '/home/httpd/perl/loncron' www");
1.1       harris41   45: }
                     46: elsif ($command eq "status") {
                     47:     $response=`/bin/cat /home/httpd/perl/logs/*.pid 2>&1`;
                     48:     if ($response=~/No such file or directory/) {
1.6       harris41   49: 	print 'LON-CAPA is not running.'."\n";
1.1       harris41   50:     }
                     51:     else {
1.6       harris41   52: 	print 'LON-CAPA is running.'."\n";
1.1       harris41   53:     }
                     54: }
                     55: else {
1.6       harris41   56:     print 'You need to specify restart|stop|start|status on the command line'.
                     57: 	' argument.'."\n";
1.1       harris41   58: }

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