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