Bugzilla – Attachment 70458 Details for
Bug 19962
Introduce koha-sip to replace koha-*-sip
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Bug 19962 - Introduce koha-sip to replace koha-*-sip
0001-Bug-19962-Introduce-koha-sip-to-replace-koha-sip.patch (text/plain), 27.14 KB, created by
Pongtawat
on 2018-01-12 10:14:38 UTC
(
hide
)
Description:
Bug 19962 - Introduce koha-sip to replace koha-*-sip
Filename:
MIME Type:
Creator:
Pongtawat
Created:
2018-01-12 10:14:38 UTC
Size:
27.14 KB
patch
obsolete
>From f881112dd79db6f451b69c9d9526cfbd12ff65fd Mon Sep 17 00:00:00 2001 >From: Pongtawat C <pongtawat@punsarn.asia> >Date: Fri, 12 Jan 2018 17:10:50 +0700 >Subject: [PATCH 1/1] Bug 19962 - Introduce koha-sip to replace koha-*-sip > >--- > ...62-Introduce-koha-sip-to-replace-koha-sip.patch | 456 +++++++++++++++++++++ > debian/scripts/koha-enable-sip | 25 +- > debian/scripts/koha-sip | 280 +++++++++++++ > debian/scripts/koha-start-sip | 55 +-- > debian/scripts/koha-stop-sip | 32 +- > 5 files changed, 745 insertions(+), 103 deletions(-) > create mode 100644 0001-Bug-19962-Introduce-koha-sip-to-replace-koha-sip.patch > create mode 100755 debian/scripts/koha-sip > >diff --git a/0001-Bug-19962-Introduce-koha-sip-to-replace-koha-sip.patch b/0001-Bug-19962-Introduce-koha-sip-to-replace-koha-sip.patch >new file mode 100644 >index 0000000000..e55b5432e9 >--- /dev/null >+++ b/0001-Bug-19962-Introduce-koha-sip-to-replace-koha-sip.patch >@@ -0,0 +1,456 @@ >+From 12be9e6fe44d7ab30a291ae7de74760feefa36d1 Mon Sep 17 00:00:00 2001 >+From: Pongtawat C <pongtawat@punsarn.asia> >+Date: Fri, 12 Jan 2018 17:09:34 +0700 >+Subject: [PATCH 1/1] Bug 19962 - Introduce koha-sip to replace koha-*-sip >+ >+--- >+ debian/scripts/koha-enable-sip | 25 +--- >+ debian/scripts/koha-sip | 280 +++++++++++++++++++++++++++++++++++++++++ >+ debian/scripts/koha-start-sip | 55 +------- >+ debian/scripts/koha-stop-sip | 32 +---- >+ 4 files changed, 289 insertions(+), 103 deletions(-) >+ create mode 100755 debian/scripts/koha-sip >+ >+diff --git a/debian/scripts/koha-enable-sip b/debian/scripts/koha-enable-sip >+index 1bcdd97571..a1c784cb97 100755 >+--- a/debian/scripts/koha-enable-sip >++++ b/debian/scripts/koha-enable-sip >+@@ -1,7 +1,7 @@ >+ #!/bin/sh >+ # >+-# koha-enable-sip -- Set up the config files to allow SIP to run >+-# Copyright 2012 Catalyst IT, Ltd >++# koha-start-sip -- Enable SIP server for named Koha instance (compat) >++# Copyright 2018 Punsarn Asia >+ # >+ # This program is free software: you can redistribute it and/or modify >+ # it under the terms of the GNU General Public License as published by >+@@ -16,23 +16,4 @@ >+ # You should have received a copy of the GNU General Public License >+ # along with this program. If not, see <http://www.gnu.org/licenses/>. >+ >+-set -e >+- >+-for name in "$@" >+-do >+- if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; >+- then >+- echo "No such instance: ${name}" > /dev/stderr >+- continue; >+- fi >+- sipfile=/etc/koha/sites/${name}/SIPconfig.xml >+- if [ -e ${sipfile} ] >+- then >+- echo "SIP already enabled for $name" >+- else >+- echo "Enabling SIP for $name - edit ${sipfile} to configure" >+- cp -v /etc/koha/SIPconfig.xml ${sipfile} >+- chown ${name}-koha:${name}-koha ${sipfile} >+- chmod 600 ${sipfile} >+- fi >+-done >++koha-sip --enable $@ >+diff --git a/debian/scripts/koha-sip b/debian/scripts/koha-sip >+new file mode 100755 >+index 0000000000..0d450f714f >+--- /dev/null >++++ b/debian/scripts/koha-sip >+@@ -0,0 +1,280 @@ >++#!/bin/bash >++# >++# koha-sip - Manage SIP Daemons for Koha instances >++# >++# Copyright 2015 Theke Solutions >++# Copyright 2018 Punsarn Asia >++# >++# This file is part of Koha. >++# >++# This program is free software: you can redistribute it and/or modify >++# it under the terms of the GNU General Public License as published by >++# the Free Software Foundation, either version 3 of the License, or >++# (at your option) any later version. >++# >++# This program is distributed in the hope that it will be useful, >++# but WITHOUT ANY WARRANTY; without even the implied warranty of >++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >++# GNU General Public License for more details. >++# >++# You should have received a copy of the GNU General Public License >++# along with this program. If not, see <http://www.gnu.org/licenses/>. >++ >++set -e >++ >++. /lib/lsb/init-functions >++ >++# Read configuration variable file if it is present >++[ -r /etc/default/koha-common ] && . /etc/default/koha-common >++ >++# include helper functions >++if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >++ . "/usr/share/koha/bin/koha-functions.sh" >++else >++ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 >++ exit 1 >++fi >++ >++usage() >++{ >++ local scriptname=$(basename $0) >++ >++ cat <<EOF >++$scriptname >++ >++This script lets you manage the SIP daemon for your Koha instances. >++ >++Usage: >++$scriptname [--start|--stop|--restart] [--quiet|-q] instancename1 [instancename2...] >++$scriptname --enable|--disable instancename1 [instancename2] >++$scriptname -h|--help >++ >++ --start Start the SIP daemon for the specified instances >++ --stop Stop the SIP daemon for the specified instances >++ --restart Restart the SIP daemon for the specified instances >++ --enable Enable SIP for the specified instances >++ --disable Disable SIP For the specified instances >++ --quiet|-q Make the script quiet about non existent instance names >++ (useful for calling from another scripts). >++ --help|-h Display this help message >++ >++EOF >++} >++ >++start_sip() >++{ >++ local name=$1 >++ >++ if ! is_sip_running $instancename; then >++ export KOHA_CONF="/etc/koha/sites/$instancename/koha-conf.xml" >++ >++ DAEMONOPTS="--name=$instancename-koha-sip \ >++ --errlog=/var/log/koha/$instancename/sip-error.log \ >++ --stdout=/var/log/koha/$instancename/sip.log \ >++ --output=/var/log/koha/$instancename/sip-output.log \ >++ --pidfiles=/var/run/koha/$instancename/ \ >++ --verbose=1 --respawn --delay=30 \ >++ --user=$instancename-koha.$instancename-koha" >++ >++ log_daemon_msg "Starting Koha SIP daemon for $instancename" >++ >++ if daemon $DAEMONOPTS -- $SIP_DAEMON "/etc/koha/sites/${name}/SIPconfig.xml"; then >++ log_end_msg 0 >++ else >++ log_end_msg 1 >++ fi >++ else >++ log_daemon_msg "Error: SIP daemon already running for $instancename" >++ log_end_msg 1 >++ fi >++} >++ >++stop_sip() >++{ >++ local name=$1 >++ >++ if is_sip_running $instancename; then >++ local PIDFILE="/var/run/koha/${instancename}/${instancename}-koha-sip.pid" >++ >++ log_daemon_msg "Stopping Koha SIP daemon for $instancename" >++ >++ if start-stop-daemon --pidfile ${PIDFILE} --stop --retry=TERM/30/KILL/5; then >++ log_end_msg 0 >++ else >++ log_end_msg 1 >++ fi >++ else >++ log_daemon_msg "Error: SIP daemon not running for $instancename" >++ log_end_msg 1 >++ fi >++} >++ >++restart_sip() >++{ >++ local name=$1 >++ >++ if is_sip_running $instancename; then >++ >++ log_daemon_msg "Restarting Koha SIP daemon for $instancename" >++ >++ if stop_sip $instancename && start_sip $instancename; then >++ log_end_msg 0 >++ else >++ log_end_msg 1 >++ fi >++ else >++ log_daemon_msg "Error: SIP daemon not running for $instancename" >++ log_end_msg 1 >++ fi >++} >++ >++enable_sip() >++{ >++ local instancename=$1 >++ >++ local sipfile=/etc/koha/sites/${instancename}/SIPconfig.xml >++ >++ if ! is_sip_enabled $instancename; then >++ if [ -e ${sipfile}.disabled ]; then >++ mv ${sipfile}.disabled ${sipfile} >++ else >++ cp /etc/koha/SIPconfig.xml ${sipfile} >++ fi >++ >++ chown ${instancename}-koha:${instancename}-koha ${sipfile} >++ chmod 600 ${sipfile} >++ >++ [ "${quiet}" != "yes" ] && warn "SIP enabled for ${instancename} - edit ${sipfile} to configure" >++# return 0 >++ else >++ [ "${quiet}" != "yes" ] && warn "SIP already enabled for ${instancename}" >++# return 1 >++ fi >++} >++ >++disable_sip() >++{ >++ local instancename=$1 >++ >++ local sipfile=/etc/koha/sites/${instancename}/SIPconfig.xml >++ >++ if is_sip_enabled $instancename; then >++ mv ${sipfile} ${sipfile}.disabled >++ >++ [ "${quiet}" != "yes" ] && warn "SIP disabled for ${instancename}" >++# return 0 >++ else >++ [ "${quiet}" != "yes" ] && warn "SIP already disabled for ${instancename}" >++# return 1 >++ fi >++} >++ >++is_sip_running() >++{ >++ local instancename=$1 >++ local PIDFILE="/var/run/koha/${instancename}/${instancename}-koha-sip.pid" >++ >++ if start-stop-daemon --pidfile ${PIDFILE} --status ; then >++ return 0 >++ else >++ return 1 >++ fi >++} >++ >++set_action() >++{ >++ if [ "$op" = "" ]; then >++ op=$1 >++ else >++ die "Error: only one action can be specified." >++ fi >++} >++ >++op="" >++quiet="no" >++ >++# Read command line parameters >++while [ $# -gt 0 ]; do >++ >++ case "$1" in >++ -h|--help) >++ usage ; exit 0 ;; >++ -q|--quiet) >++ quiet="yes" >++ shift ;; >++ --start) >++ set_action "start" >++ shift ;; >++ --stop) >++ set_action "stop" >++ shift ;; >++ --restart) >++ set_action "restart" >++ shift ;; >++ --enable) >++ set_action "enable" >++ shift ;; >++ --disable) >++ set_action "disable" >++ shift ;; >++ -*) >++ die "Error: invalid option switch ($1)" ;; >++ *) >++ # We expect the remaining stuff are the instance names >++ break ;; >++ esac >++ >++done >++ >++ >++if [ $# -gt 0 ]; then >++ # We have at least one instance name >++ for instancename in "$@"; do >++ >++ if is_instance $instancename; then >++ >++ adjust_paths_dev_install $instancename >++ export PERL5LIB >++ >++ if [ "$DEV_INSTALL" = "" ]; then >++ SIP_DAEMON="perl ${KOHA_HOME}/lib/C4/SIP/SIPServer.pm" >++ else >++ SIP_DAEMON="perl ${KOHA_HOME}/C4/SIP/SIPServer.pm" >++ fi >++ >++ case $op in >++ "start") >++ start_sip $instancename >++ ;; >++ "stop") >++ stop_sip $instancename >++ ;; >++ "restart") >++ restart_sip $instancename >++ ;; >++ "enable") >++ enable_sip $instancename >++ ;; >++ "disable") >++ disable_sip $instancename >++ ;; >++ *) >++ usage >++ ;; >++ esac >++ >++ else >++ if [ "$quiet" = "no" ]; then >++ log_daemon_msg "Error: Invalid instance name $instancename" >++ log_end_msg 1 >++ fi >++ fi >++ >++ done >++else >++ if [ "$quiet" = "no" ]; then >++ warn "Error: you must provide at least one instance name" >++ fi >++fi >++ >++exit 0 >+diff --git a/debian/scripts/koha-start-sip b/debian/scripts/koha-start-sip >+index 7f4f8182bd..ca2e634051 100755 >+--- a/debian/scripts/koha-start-sip >++++ b/debian/scripts/koha-start-sip >+@@ -1,7 +1,7 @@ >+ #!/bin/sh >+ # >+-# koha-start-sip -- Start SIP server for named Koha instance >+-# Copyright 2012 Catalyst IT, Ltd >++# koha-start-sip -- Start SIP server for named Koha instance (compat) >++# Copyright 2018 Punsarn Asia >+ # >+ # This program is free software: you can redistribute it and/or modify >+ # it under the terms of the GNU General Public License as published by >+@@ -16,53 +16,4 @@ >+ # You should have received a copy of the GNU General Public License >+ # along with this program. If not, see <http://www.gnu.org/licenses/>. >+ >+-set -e >+- >+-# Read configuration variable file if it is present >+-[ -r /etc/default/koha-common ] && . /etc/default/koha-common >+- >+-# include helper functions >+-if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+- . "/usr/share/koha/bin/koha-functions.sh" >+-else >+- echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 >+- exit 1 >+-fi >+- >+-for name in "$@" >+-do >+- if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; >+- then >+- echo "No such instance: ${name}" > /dev/stderr >+- continue; >+- fi >+- [ -e /etc/koha/sites/${name}/SIPconfig.xml ] || continue >+- echo "Starting SIP server for $name" >+- mkdir -p /var/run/koha/${name} >+- chown "${name}-koha:${name}-koha" /var/run/koha/${name} >+- >+- adjust_paths_dev_install $name >+- export KOHA_CONF PERL5LIB >+- KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml >+- # PERL5LIB has been read already >+- if [ "$DEV_INSTALL" = "" ]; then >+- LIBDIR=$KOHA_HOME/lib >+- else >+- LIBDIR=$KOHA_HOME >+- fi >+- >+- daemon \ >+- --name="$name-koha-sip" \ >+- --errlog="/var/log/koha/$name/sip-error.log" \ >+- --stdout="/var/log/koha/$name/sip.log" \ >+- --output="/var/log/koha/$name/sip-output.log" \ >+- --verbose=1 \ >+- --respawn \ >+- --delay=30 \ >+- --pidfiles="/var/run/koha/${name}" \ >+- --user="$name-koha.$name-koha" \ >+- -- \ >+- perl \ >+- "$LIBDIR/C4/SIP/SIPServer.pm" \ >+- "/etc/koha/sites/${name}/SIPconfig.xml" >+-done >++koha-sip --start $@ >+diff --git a/debian/scripts/koha-stop-sip b/debian/scripts/koha-stop-sip >+index bfe7cd31c6..0cc885b854 100755 >+--- a/debian/scripts/koha-stop-sip >++++ b/debian/scripts/koha-stop-sip >+@@ -1,7 +1,7 @@ >+ #!/bin/sh >+ # >+-# koha-stop-sip -- Stop SIP server for named Koha instance >+-# Copyright 2012 Catalyst IT, Ltd >++# koha-start-sip -- Stop SIP server for named Koha instance (compat) >++# Copyright 2018 Punsarn Asia >+ # >+ # This program is free software: you can redistribute it and/or modify >+ # it under the terms of the GNU General Public License as published by >+@@ -16,30 +16,4 @@ >+ # You should have received a copy of the GNU General Public License >+ # along with this program. If not, see <http://www.gnu.org/licenses/>. >+ >+-set -e >+- >+-for name in "$@" >+-do >+- if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; >+- then >+- echo "No such instance: ${name}" > /dev/stderr >+- continue; >+- fi >+- if [ ! -e /var/run/koha/${name}/${name}-koha-sip.pid ] ; >+- then >+- echo "SIP server for ${name} not running." >+- continue; >+- fi >+- echo "Stopping SIP server for $name" >+- daemon \ >+- --name="$name-koha-sip" \ >+- --errlog="/var/log/koha/$name/sip-error.log" \ >+- --stdout="/var/log/koha/$name/sip.log" \ >+- --output="/var/log/koha/$name/sip-output.log" \ >+- --verbose=1 \ >+- --respawn \ >+- --delay=30 \ >+- --pidfiles="/var/run/koha/${name}" \ >+- --user="$name-koha.$name-koha" \ >+- --stop >+-done >++koha-sip --stop $@ >+-- >+2.15.1 >+ >diff --git a/debian/scripts/koha-enable-sip b/debian/scripts/koha-enable-sip >index 1bcdd97571..393eabb94a 100755 >--- a/debian/scripts/koha-enable-sip >+++ b/debian/scripts/koha-enable-sip >@@ -1,7 +1,7 @@ > #!/bin/sh > # >-# koha-enable-sip -- Set up the config files to allow SIP to run >-# Copyright 2012 Catalyst IT, Ltd >+# koha-enable-sip -- Enable SIP server for named Koha instance (compat) >+# Copyright 2018 Punsarn Asia > # > # This program is free software: you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by >@@ -16,23 +16,4 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > >-set -e >- >-for name in "$@" >-do >- if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; >- then >- echo "No such instance: ${name}" > /dev/stderr >- continue; >- fi >- sipfile=/etc/koha/sites/${name}/SIPconfig.xml >- if [ -e ${sipfile} ] >- then >- echo "SIP already enabled for $name" >- else >- echo "Enabling SIP for $name - edit ${sipfile} to configure" >- cp -v /etc/koha/SIPconfig.xml ${sipfile} >- chown ${name}-koha:${name}-koha ${sipfile} >- chmod 600 ${sipfile} >- fi >-done >+koha-sip --enable $@ >diff --git a/debian/scripts/koha-sip b/debian/scripts/koha-sip >new file mode 100755 >index 0000000000..0d450f714f >--- /dev/null >+++ b/debian/scripts/koha-sip >@@ -0,0 +1,280 @@ >+#!/bin/bash >+# >+# koha-sip - Manage SIP Daemons for Koha instances >+# >+# Copyright 2015 Theke Solutions >+# Copyright 2018 Punsarn Asia >+# >+# This file is part of Koha. >+# >+# This program is free software: you can redistribute it and/or modify >+# it under the terms of the GNU General Public License as published by >+# the Free Software Foundation, either version 3 of the License, or >+# (at your option) any later version. >+# >+# This program is distributed in the hope that it will be useful, >+# but WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with this program. If not, see <http://www.gnu.org/licenses/>. >+ >+set -e >+ >+. /lib/lsb/init-functions >+ >+# Read configuration variable file if it is present >+[ -r /etc/default/koha-common ] && . /etc/default/koha-common >+ >+# include helper functions >+if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >+ . "/usr/share/koha/bin/koha-functions.sh" >+else >+ echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 >+ exit 1 >+fi >+ >+usage() >+{ >+ local scriptname=$(basename $0) >+ >+ cat <<EOF >+$scriptname >+ >+This script lets you manage the SIP daemon for your Koha instances. >+ >+Usage: >+$scriptname [--start|--stop|--restart] [--quiet|-q] instancename1 [instancename2...] >+$scriptname --enable|--disable instancename1 [instancename2] >+$scriptname -h|--help >+ >+ --start Start the SIP daemon for the specified instances >+ --stop Stop the SIP daemon for the specified instances >+ --restart Restart the SIP daemon for the specified instances >+ --enable Enable SIP for the specified instances >+ --disable Disable SIP For the specified instances >+ --quiet|-q Make the script quiet about non existent instance names >+ (useful for calling from another scripts). >+ --help|-h Display this help message >+ >+EOF >+} >+ >+start_sip() >+{ >+ local name=$1 >+ >+ if ! is_sip_running $instancename; then >+ export KOHA_CONF="/etc/koha/sites/$instancename/koha-conf.xml" >+ >+ DAEMONOPTS="--name=$instancename-koha-sip \ >+ --errlog=/var/log/koha/$instancename/sip-error.log \ >+ --stdout=/var/log/koha/$instancename/sip.log \ >+ --output=/var/log/koha/$instancename/sip-output.log \ >+ --pidfiles=/var/run/koha/$instancename/ \ >+ --verbose=1 --respawn --delay=30 \ >+ --user=$instancename-koha.$instancename-koha" >+ >+ log_daemon_msg "Starting Koha SIP daemon for $instancename" >+ >+ if daemon $DAEMONOPTS -- $SIP_DAEMON "/etc/koha/sites/${name}/SIPconfig.xml"; then >+ log_end_msg 0 >+ else >+ log_end_msg 1 >+ fi >+ else >+ log_daemon_msg "Error: SIP daemon already running for $instancename" >+ log_end_msg 1 >+ fi >+} >+ >+stop_sip() >+{ >+ local name=$1 >+ >+ if is_sip_running $instancename; then >+ local PIDFILE="/var/run/koha/${instancename}/${instancename}-koha-sip.pid" >+ >+ log_daemon_msg "Stopping Koha SIP daemon for $instancename" >+ >+ if start-stop-daemon --pidfile ${PIDFILE} --stop --retry=TERM/30/KILL/5; then >+ log_end_msg 0 >+ else >+ log_end_msg 1 >+ fi >+ else >+ log_daemon_msg "Error: SIP daemon not running for $instancename" >+ log_end_msg 1 >+ fi >+} >+ >+restart_sip() >+{ >+ local name=$1 >+ >+ if is_sip_running $instancename; then >+ >+ log_daemon_msg "Restarting Koha SIP daemon for $instancename" >+ >+ if stop_sip $instancename && start_sip $instancename; then >+ log_end_msg 0 >+ else >+ log_end_msg 1 >+ fi >+ else >+ log_daemon_msg "Error: SIP daemon not running for $instancename" >+ log_end_msg 1 >+ fi >+} >+ >+enable_sip() >+{ >+ local instancename=$1 >+ >+ local sipfile=/etc/koha/sites/${instancename}/SIPconfig.xml >+ >+ if ! is_sip_enabled $instancename; then >+ if [ -e ${sipfile}.disabled ]; then >+ mv ${sipfile}.disabled ${sipfile} >+ else >+ cp /etc/koha/SIPconfig.xml ${sipfile} >+ fi >+ >+ chown ${instancename}-koha:${instancename}-koha ${sipfile} >+ chmod 600 ${sipfile} >+ >+ [ "${quiet}" != "yes" ] && warn "SIP enabled for ${instancename} - edit ${sipfile} to configure" >+# return 0 >+ else >+ [ "${quiet}" != "yes" ] && warn "SIP already enabled for ${instancename}" >+# return 1 >+ fi >+} >+ >+disable_sip() >+{ >+ local instancename=$1 >+ >+ local sipfile=/etc/koha/sites/${instancename}/SIPconfig.xml >+ >+ if is_sip_enabled $instancename; then >+ mv ${sipfile} ${sipfile}.disabled >+ >+ [ "${quiet}" != "yes" ] && warn "SIP disabled for ${instancename}" >+# return 0 >+ else >+ [ "${quiet}" != "yes" ] && warn "SIP already disabled for ${instancename}" >+# return 1 >+ fi >+} >+ >+is_sip_running() >+{ >+ local instancename=$1 >+ local PIDFILE="/var/run/koha/${instancename}/${instancename}-koha-sip.pid" >+ >+ if start-stop-daemon --pidfile ${PIDFILE} --status ; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ >+set_action() >+{ >+ if [ "$op" = "" ]; then >+ op=$1 >+ else >+ die "Error: only one action can be specified." >+ fi >+} >+ >+op="" >+quiet="no" >+ >+# Read command line parameters >+while [ $# -gt 0 ]; do >+ >+ case "$1" in >+ -h|--help) >+ usage ; exit 0 ;; >+ -q|--quiet) >+ quiet="yes" >+ shift ;; >+ --start) >+ set_action "start" >+ shift ;; >+ --stop) >+ set_action "stop" >+ shift ;; >+ --restart) >+ set_action "restart" >+ shift ;; >+ --enable) >+ set_action "enable" >+ shift ;; >+ --disable) >+ set_action "disable" >+ shift ;; >+ -*) >+ die "Error: invalid option switch ($1)" ;; >+ *) >+ # We expect the remaining stuff are the instance names >+ break ;; >+ esac >+ >+done >+ >+ >+if [ $# -gt 0 ]; then >+ # We have at least one instance name >+ for instancename in "$@"; do >+ >+ if is_instance $instancename; then >+ >+ adjust_paths_dev_install $instancename >+ export PERL5LIB >+ >+ if [ "$DEV_INSTALL" = "" ]; then >+ SIP_DAEMON="perl ${KOHA_HOME}/lib/C4/SIP/SIPServer.pm" >+ else >+ SIP_DAEMON="perl ${KOHA_HOME}/C4/SIP/SIPServer.pm" >+ fi >+ >+ case $op in >+ "start") >+ start_sip $instancename >+ ;; >+ "stop") >+ stop_sip $instancename >+ ;; >+ "restart") >+ restart_sip $instancename >+ ;; >+ "enable") >+ enable_sip $instancename >+ ;; >+ "disable") >+ disable_sip $instancename >+ ;; >+ *) >+ usage >+ ;; >+ esac >+ >+ else >+ if [ "$quiet" = "no" ]; then >+ log_daemon_msg "Error: Invalid instance name $instancename" >+ log_end_msg 1 >+ fi >+ fi >+ >+ done >+else >+ if [ "$quiet" = "no" ]; then >+ warn "Error: you must provide at least one instance name" >+ fi >+fi >+ >+exit 0 >diff --git a/debian/scripts/koha-start-sip b/debian/scripts/koha-start-sip >index 7f4f8182bd..ca2e634051 100755 >--- a/debian/scripts/koha-start-sip >+++ b/debian/scripts/koha-start-sip >@@ -1,7 +1,7 @@ > #!/bin/sh > # >-# koha-start-sip -- Start SIP server for named Koha instance >-# Copyright 2012 Catalyst IT, Ltd >+# koha-start-sip -- Start SIP server for named Koha instance (compat) >+# Copyright 2018 Punsarn Asia > # > # This program is free software: you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by >@@ -16,53 +16,4 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > >-set -e >- >-# Read configuration variable file if it is present >-[ -r /etc/default/koha-common ] && . /etc/default/koha-common >- >-# include helper functions >-if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then >- . "/usr/share/koha/bin/koha-functions.sh" >-else >- echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2 >- exit 1 >-fi >- >-for name in "$@" >-do >- if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; >- then >- echo "No such instance: ${name}" > /dev/stderr >- continue; >- fi >- [ -e /etc/koha/sites/${name}/SIPconfig.xml ] || continue >- echo "Starting SIP server for $name" >- mkdir -p /var/run/koha/${name} >- chown "${name}-koha:${name}-koha" /var/run/koha/${name} >- >- adjust_paths_dev_install $name >- export KOHA_CONF PERL5LIB >- KOHA_CONF=/etc/koha/sites/${name}/koha-conf.xml >- # PERL5LIB has been read already >- if [ "$DEV_INSTALL" = "" ]; then >- LIBDIR=$KOHA_HOME/lib >- else >- LIBDIR=$KOHA_HOME >- fi >- >- daemon \ >- --name="$name-koha-sip" \ >- --errlog="/var/log/koha/$name/sip-error.log" \ >- --stdout="/var/log/koha/$name/sip.log" \ >- --output="/var/log/koha/$name/sip-output.log" \ >- --verbose=1 \ >- --respawn \ >- --delay=30 \ >- --pidfiles="/var/run/koha/${name}" \ >- --user="$name-koha.$name-koha" \ >- -- \ >- perl \ >- "$LIBDIR/C4/SIP/SIPServer.pm" \ >- "/etc/koha/sites/${name}/SIPconfig.xml" >-done >+koha-sip --start $@ >diff --git a/debian/scripts/koha-stop-sip b/debian/scripts/koha-stop-sip >index bfe7cd31c6..b1cb22b06f 100755 >--- a/debian/scripts/koha-stop-sip >+++ b/debian/scripts/koha-stop-sip >@@ -1,7 +1,7 @@ > #!/bin/sh > # >-# koha-stop-sip -- Stop SIP server for named Koha instance >-# Copyright 2012 Catalyst IT, Ltd >+# koha-stop-sip -- Stop SIP server for named Koha instance (compat) >+# Copyright 2018 Punsarn Asia > # > # This program is free software: you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by >@@ -16,30 +16,4 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > >-set -e >- >-for name in "$@" >-do >- if [ ! -e /etc/koha/sites/${name}/koha-conf.xml ] ; >- then >- echo "No such instance: ${name}" > /dev/stderr >- continue; >- fi >- if [ ! -e /var/run/koha/${name}/${name}-koha-sip.pid ] ; >- then >- echo "SIP server for ${name} not running." >- continue; >- fi >- echo "Stopping SIP server for $name" >- daemon \ >- --name="$name-koha-sip" \ >- --errlog="/var/log/koha/$name/sip-error.log" \ >- --stdout="/var/log/koha/$name/sip.log" \ >- --output="/var/log/koha/$name/sip-output.log" \ >- --verbose=1 \ >- --respawn \ >- --delay=30 \ >- --pidfiles="/var/run/koha/${name}" \ >- --user="$name-koha.$name-koha" \ >- --stop >-done >+koha-sip --stop $@ >-- >2.15.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 19962
:
70458
|
70459