From 248a1ac6533ad56ff2ece7a8166fadf62aeb600e Mon Sep 17 00:00:00 2001 From: Robert Soulliere Date: Mon, 28 Feb 2011 15:59:22 -0500 Subject: [PATCH 1/1] Add startup options and Startup script from Anoop Atre. --- 1.6/admin/AdminMisc.xml | 271 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 268 insertions(+), 3 deletions(-) diff --git a/1.6/admin/AdminMisc.xml b/1.6/admin/AdminMisc.xml index ec6144ef98..db21f40172 100644 --- a/1.6/admin/AdminMisc.xml +++ b/1.6/admin/AdminMisc.xml @@ -44,9 +44,9 @@ If you decide to start each service individually, you need to start them in a specific order for Evergreen to start correctly. Run the commands in this exact order: - osrf_ctl.sh -l -a start_router - osrf_ctl.sh -l -a start_perl - osrf_ctl.sh -l -a start_c +osrf_ctl.sh -l -a start_router +osrf_ctl.sh -l -a start_perl +osrf_ctl.sh -l -a start_c After starting or restarting Evergreen, it is also necessary to restart the Apache web server web serverApache for the OPAC to work correctly. @@ -55,6 +55,271 @@ As with starting, you can choose to stop services individually. To restart Evergreen, run: osrf_ctl.sh -l -a restart_all + + Starting Specific Perl Services + It is also possible to start and stop a specific perl service using opensrf-perl.pl. Here is the syntax for starting a perl service with this command: +opensrf-perl.pl --service <service-name> -a start -p <PID-directory> +Example (starting the booking module): +opensrf-perl.pl --service open-ils.booking -a start -p /openils/var/run/opensrf + +This is the syntax for stopping a perl service with this command: +opensrf-perl.pl --service <service-name> -a stop -p <PID-directory> +Example (stopping the booking module): +opensrf-perl.pl --service open-ils.booking -a stop -p /openils/var/run/opensrf + These commands can be very useful when you edit Perl modules and only need to restart the specific service for changes to take effect. + + + The default for the PID-directory: /openils/var/run/opensrf + For a clustered server instance of Evergreen, you must store the PIDs on a directory + that is local to each server, or else one of your cluster servers may try killing processes on itself that actually have PIDs on other servers. + For services running on the local server use the to force the hostname to be localhost, + instead of the fully qualified domain name for the machine. + To see other options run the command with the option: +opensrf-perl.pl -h + +For a list of Evergreen/OpenSRF perl services see: . + + +
+ Automating Evergreen Startup and Shutdown + Once you understand starting and stopping Evergreen, you will want to create a start up script for two purposes: + + Allow you to start, restart and stop Evergreen, SIP, reporter and z39.50 services with one command. + Allow Evergreen to stop and start properly during a system restart. + + The following procedure is for Debian or Ubuntu distributions of Linux. + + + Create a bash script for starting Evergreen and all associated services. Here is an example script: + + +> ${SRU_LOG} 2>&1" & + sleep 1 + pids=`ps -eo pid,args | grep $sru_name | grep -v grep | cut -c1-6` + if [ x"$pids" = x ] ; then + echo FAILURE + else + echo OK + fi + echo "Starting Z39.50/SRU: $pids" + return $RETVAL +} + +z39_50_stop() { + pids=`ps -eo pid,args | grep $sru_name | grep -v grep | cut -c1-6` + if [ x"$pids" = x ] ; then + echo FAILURE ; echo $"Stopping Z39.50/SRU: not running" ; RETVAL=1 + else + kill $pids ; RETVAL=$? + if [ $RETVAL ] ; then + echo OK ; echo $"Stopping Z39.50/SRU: $pids" + else + echo FAILURE + fi + fi + return $RETVAL +} + +case "$1" in + start) + start + start_rep + z39_50_start + sip_start + ;; + stop) + sip_stop + z39_50_stop + stop_rep + stop + ;; + restart) + echo "Restarting Evergreen, Reporter and Z39.50 Processes" + sip_stop + z39_50_stop + stop_rep + stop + start + start_rep + z39_50_start + sip_start + ;; + autogen) + autogen + ;; + sip_start) + sip_start + ;; + sip_stop) + sip_stop + ;; + sip_restart) + sip_restart + ;; + start_reporter) + start_rep + ;; + stop_reporter) + stop_rep + ;; + restart_reporter) + stop_rep + start_rep + ;; + z39_50_start) + z39_50_start + ;; + z39_50_stop) + z39_50_stop + ;; + z39_50_restart) + z39_50_stop + z39_50_start + ;; + start_router|stop_router|restart_router|start_perl|stop_perl|restart_perl| \ + start_c|stop_c|restart_c|start_osrf|stop_osrf|restart_osrf|stop_all|start_all|restart_all) + sudo -u opensrf /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin osrf_ctl.sh -l -a $1" + ;; + *) + echo " * Usage: /etc/init.d/evergreen {start|stop|restart|autogen" + echo " |sip_start|sip_stop|sip_restart" + echo " |z39_50_start|z39_50_stop|z39_50_restart" + echo " |start_reporter|stop_reporter|restart_reporter" + echo " |start_router|stop_router|restart_router|start_perl|stop_perl|restart_perl" + echo " |start_c|stop_c|restart_c|start_osrf|stop_osrf|restart_osrf|stop_all|start_all|restart_all}" + exit 1 + ;; +esac; +]]> + + + + Save file in /etc/init.d folder. + + + Ensure that it is executable. +sudo chmod 755 evergreenstart + + + Test the script by running it from the command line as the root user. +/etc/init.d/evergreenstart restart + You will also need to restart apache as the root user. +/etc/init.d/apache2 restart + + + Test the script by running it from the command line as the root user. +/etc/init.d/evergreenstart restart + You will also need to restart apache as root. +/etc/init.d/apache2 restart + + + Update runlevel defaults of the new evergreenstart service as the root user: +update-rc.d evergreenstart defaults 80 20 +For Evergreen to start properly during a reboot, you will want to ensure that the first number is lower than the assigned starting priority for Apache so it starts before Apache. It should also a higher stopping priority than Apache so it stops after Apache at shutdown. + + + For more information on update-rc.d you should review the documentation on this topic for + Debian or Ubuntu depending on your distribution of Linux.
Backing Up -- 2.43.2