GIT_REMOTE="kcls"
REBUILD=""
ACTIONS=""
+ADMIN_PASS=""
# if the script exits early, SUCCESS will be left as 0,
# which is our sign to warn the user.
detach
stop-apache
stop-eg
+ stop-util (z39, connexion, hold targeter)
+ stop-sip
update-eg
deploy-eg
update-web
build-staff
start-eg
start-apache
+ start-util
+ start-sip
attach
stop-all (detach,stop-apache,stop-eg)
deploy-all (update-eg,deploy-eg)
-d Number of seconds to wait after detach. The default is
$DETACH_SLEEP.
+ -w Admin password. Needed for starting utility services,
+ specifically the marc_stream_importer (for Connexion).
+
USAGE
trap - EXIT
exit;
sleep $START_SLEEP;
}
+function stop_util {
+ announce "Stopping utility services"
+
+ announce "Stopping hold targeter"
+ [ -f /tmp/hold_targeter-LOCK ] && \
+ sudo kill $(cat /tmp/hold_targeter-LOCK)
+
+ cd $EVERGREEN_BASE/KCLS/admin-scripts;
+
+ announce "Stopping Z39.50"
+ sudo ./eg-zoom-control.sh stop
+
+ announce "Stopping Connexion"
+ sudo ./eg-marc-stream-control.sh stop
+
+ cd $EVERGREEN_BASE;
+}
+
+function start_util {
+ announce "Starting utility services"
+
+ announce "Removing hold targeter lock file"
+ sudo rm -f /tmp/hold_targeter-LOCK
+
+ cd $EVERGREEN_BASE/KCLS/admin-scripts;
+
+ announce "Starting Z39.50"
+ sudo ./eg-zoom-control.sh start
+
+ if [ -n "$ADMIN_PASS" ]; then
+ announce "Starting Connextion"
+ sudo ./eg-marc-stream-control.sh start "$ADMIN_PASS"
+ else
+ announce "Starting Connexion requires the admin password"
+ announce "Provide password via -w or start manually:"
+ announce "sudo ./eg-marc-stream-control.sh start <pass>"
+ fi
+
+ cd $EVERGREEN_BASE;
+}
+
+function start_sip {
+ OSRF_LOG_CLIENT=1 $OSRF /openils/bin/oils_ctl.sh \
+ -a start_sip -l /openils/var/log/sip_err.log
+}
+
+function stop_sip {
+ announce "Stopping SIP"
+ $OSRF /openils/bin/oils_ctl.sh -a stop_sip
+
+ if [ -f /openils/var/log/sip_err.log ]; then
+ # move the log file over so we can remove it later w/o
+ # pulling it out from under a running SIP instance.
+
+ announce "Renaming old SIP error log file"
+
+ # include the time (w/ seconds) to ensure a new log file
+ # name even if there are multiple restarts in a short period.
+ LDATE=$(date +'%FT%T')
+ $OSRF mv /openils/var/log/sip_err.log \
+ /openils/var/log/sip_err.$LDATE.log
+ fi
+}
+
+
# -- script starts here --
trap on_exit EXIT;
-while getopts "a:t:b:r:s:i:f:d:pchl" opt; do
+while getopts "a:t:b:r:s:i:f:d:pchlw:" opt; do
case $opt in
a) ACTIONS="$OPTARG";;
b) GIT_BRANCH="$OPTARG";;
r) GIT_REMOTE="$OPTARG";;
s) CLIENT_BUILD_ID="$OPTARG";;
t) GIT_TAG="$OPTARG";;
+ w) ADMIN_PASS="$OPTARG";;
h) usage;
esac
done;
fi
fi
+if [[ "$ACTIONS" =~ "stop-util" ]]; then
+ stop_util;
+fi
+
+if [[ "$ACTIONS" =~ "stop-sip" ]]; then
+ stop_sip;
+fi
+
+
if [[ "$ACTIONS" =~ "stop-eg" ]]; then
announce "Stopping services"
$OSRF /openils/bin/osrf_control --localhost \
sudo service apache2 start > /dev/null
fi
+if [[ "$ACTIONS" =~ "start-util" ]]; then
+ start_util;
+fi
+
+if [[ "$ACTIONS" =~ "start-sip" ]]; then
+ start_sip;
+fi
+
if [[ "$ACTIONS" =~ "attach" ]]; then
if [ -f $PING_FILE- ]; then
if [[ "$ACTIONS" =~ "start-apache" ]]; then