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

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

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