Bugzilla – Attachment 96813 Details for
Bug 24340
Add ability to disable SIP using koha-sip
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24340: allow koha-sip --disable inst
Bug-24340-allow-koha-sip---disable-inst.patch (text/plain), 4.89 KB, created by
David Nind
on 2020-01-04 18:57:26 UTC
(
hide
)
Description:
Bug 24340: allow koha-sip --disable inst
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-01-04 18:57:26 UTC
Size:
4.89 KB
patch
obsolete
>From c8e4fbcdf8e00190ecb5768e91ddfc32061099c8 Mon Sep 17 00:00:00 2001 >From: Liz Rea <wizzyrea@gmail.com> >Date: Fri, 3 Jan 2020 17:35:20 +0000 >Subject: [PATCH] Bug 24340: allow koha-sip --disable inst > >To test: > >- Enable sip for your testing instance > sudo koha-sip --enable inst >- Start sip for your testing instance > sudo koha-sip --start inst >- Verify it is running > ps ax |grep sip -> you should see processes >- Disable sip for your testing intance > sudo koha-sip --disable inst >- Verify that the following has happened: > * the SIPconfig.xml file has been moved to SIPconfig.xml.bak > * SIP is no longer running for your instance - no SIP processes > * SIP Cannot be started for the instance because of no config. > >Signed-off-by: David Nind <david@davidnind.com> >--- > debian/scripts/koha-sip | 66 +++++++++++++++++++++++++++++++++++-------------- > 1 file changed, 48 insertions(+), 18 deletions(-) > >diff --git a/debian/scripts/koha-sip b/debian/scripts/koha-sip >index bcc1db8ce2..d3eec7971a 100755 >--- a/debian/scripts/koha-sip >+++ b/debian/scripts/koha-sip >@@ -45,6 +45,8 @@ Usage: > $scriptname [--start|--stop|--restart] instancename1 [instancename2...] > $scriptname -h|--help > >+ --enable Enable the Koha SIP server with a default configuration >+ --disable Disable the Koha SIP server, backing up existent configurations. > --start Start the SIP server for the specified instance(s) > --stop Stop the SIP server for the specified instance(s) > --restart Restart the SIP server for the specified instance(s) >@@ -62,17 +64,19 @@ start_sip() > _check_and_fix_perms $name > > if ! is_sip_running $name; then >- >- adjust_paths_dev_install $name >- export KOHA_HOME PERL5LIB >- >- if [ "$DEV_INSTALL" = "" ]; then >- LIBDIR=$KOHA_HOME/lib >+ if [ ! -f "/etc/koha/sites/${name}/SIPconfig.xml" ] ; then >+ echo "SIP is disabled, or you do not have a SIPconfig.xml file." > else >- LIBDIR=$KOHA_HOME >- fi >+ adjust_paths_dev_install $name >+ export KOHA_HOME PERL5LIB > >- DAEMONOPTS="--name=${name}-koha-sip \ >+ if [ "$DEV_INSTALL" = "" ]; then >+ LIBDIR=$KOHA_HOME/lib >+ else >+ LIBDIR=$KOHA_HOME >+ fi >+ >+ DAEMONOPTS="--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 \ >@@ -82,18 +86,19 @@ start_sip() > --pidfiles=/var/run/koha/${name} \ > --user=${name}-koha.${name}-koha" > >- SIP_PARAMS="$LIBDIR/C4/SIP/SIPServer.pm \ >+ SIP_PARAMS="$LIBDIR/C4/SIP/SIPServer.pm \ > /etc/koha/sites/${name}/SIPconfig.xml" > >- [ "$verbose" != "no" ] && \ >- log_daemon_msg "Starting SIP server for ${name}" >+ [ "$verbose" != "no" ] && \ >+ log_daemon_msg "Starting SIP server for ${name}" > >- if daemon $DAEMONOPTS -- perl $SIP_PARAMS; then >- ([ "$verbose" != "no" ] && \ >- log_end_msg 0) || return 0 >- else >- ([ "$verbose" != "no" ] && \ >- log_end_msg 1) || return 1 >+ if daemon $DAEMONOPTS -- perl $SIP_PARAMS; then >+ ([ "$verbose" != "no" ] && \ >+ log_end_msg 0) || return 0 >+ else >+ ([ "$verbose" != "no" ] && \ >+ log_end_msg 1) || return 1 >+ fi > fi > else > if [ "$verbose" != "no" ]; then >@@ -189,6 +194,25 @@ enable_sip() > fi > } > >+disable_sip() >+{ >+ local name=$1 >+ >+ sipfile=/etc/koha/sites/${name}/SIPconfig.xml >+ >+ if is_sip_enabled ${name}; then >+ # SIP is enabled, we should disable it >+ echo "Stopping running SIP" >+ stop_sip ${name} >+ echo "Disabling SIP server for ${name} - backing up ${sipfile} to ${sipfile}.bak to preserve configurations" >+ mv ${sipfile} ${sipfile}.bak >+ echo "Warning: SIP server disabled for ${name}" >+ else >+ echo " SIP server for ${name} not enabled - use koha-sip --enable <instance> to enable. Previous configurations available, if existent, in /etc/koha/sites/${name}/SIPconfig.xml.bak" >+ fi >+} >+ >+ > _check_and_fix_perms() > { > local name=$1 >@@ -262,6 +286,9 @@ while [ $# -gt 0 ]; do > --enable) > set_action "enable" > shift ;; >+ --disable) >+ set_action "disable" >+ shift ;; > -*) > die "Error: invalid option switch ($1)" ;; > *) >@@ -294,6 +321,9 @@ if [ $# -gt 0 ]; then > ;; > "enable") > enable_sip $name >+ ;; >+ "disable") >+ disable_sip $name > esac > > else >-- >2.11.0
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24340
:
96797
|
96813
|
97360
|
97361
|
97379
|
97380
|
97381
|
98257
|
98258
|
98263
|
98716