Return to loncontrol CVS log | Up to [LON-CAPA] / loncom / init.d |
it works! priorities are set, and even though it is meant to be run as 'root', it invokes the LON-CAPA processes under the ownership of 'www'. the only other thing to do is to specify the other rc.d files (while chkconfig --add loncontrol works, the "proper" way to construct an RPM is to not use chkconfig, but rather place into explicit locations)
1: #!/usr/bin/perl 2: # 3: # Startup script for the LON-CAPA network processes 4: # Scott Harrison 10/25/2000 5: # 6: # chkconfig: 345 95 5 7: # description: LON-CAPA is an knowledge network server. It is used to distribute \ 8: # knowledge resources and instructional management. 9: # processnames: lonc, lond, lonsql 10: # pidfiles: /home/httpd/perl/logs/lon*.pid 11: # config: /etc/httpd/conf/access.conf 12: # config: /home/httpd/lonTabs/hosts.tab 13: # config: /home/httpd/lonTabs/spare.tab 14: 15: $command=$ARGV[0]; $command=~s/[^a-z]//g; 16: 17: $ENV{'PATH'}="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin"; 18: $ENV{'BASH_ENV'}=""; 19: 20: if (($command eq "restart") or ($command eq "reload")) { 21: print "Restarting LON-CAPA\n"; 22: print "Ending LON-CAPA client and daemon processes\n"; 23: print `su -c '/bin/kill \`/bin/cat /home/httpd/perl/logs/*.pid\`' www`; 24: print "Starting LON-CAPA client and daemon processes (please be patient)\n"; 25: system("su -c '/home/httpd/perl/loncron' www"); 26: print "Restarting web server\n"; 27: print `/etc/rc.d/init.d/httpd restart`; 28: } 29: elsif ($command eq "stop") { 30: print "Stopping LON-CAPA\n"; 31: print `su -c '/bin/kill \`/bin/cat /home/httpd/perl/logs/*.pid\`' www`; 32: print "Stopping web server\n"; 33: print `/etc/rc.d/init.d/httpd stop`; 34: } 35: elsif ($command eq "start") { 36: print "Starting LON-CAPA\n"; 37: print "Starting LON-CAPA client and daemon processes (please be patient)\n"; 38: system("su -c /home/httpd/perl/loncron www"); 39: print "Starting web server\n"; 40: print `/etc/rc.d/init.d/httpd start`; 41: } 42: elsif ($command eq "status") { 43: $response=`/bin/cat /home/httpd/perl/logs/*.pid 2>&1`; 44: if ($response=~/No such file or directory/) { 45: print "LON-CAPA is not running.\n"; 46: } 47: else { 48: print "LON-CAPA is running.\n"; 49: } 50: } 51: else { 52: print "You need to specify restart|stop|start|status on the command line argument.\n"; 53: }