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