From d2ccce90a4e071b3550b55dd3bc2c34ae130b33a Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 30 Mar 2021 14:17:17 +0100 Subject: [PATCH] Bug 15338: Move SIPServer to bin directory SIPServer should reside like other programs in the bin directory rather than lurking in modules removed the pm suffix which confused some users sip_run.sh can now be simplified and not fail because of misuse of path definition as a directory removed the unnecessary sourcing of .bash_profile in shutdown (what if you dont have a bash_profile?) SIP modules are now in standard lib path so Server does not need to set its own lib --- C4/SIP/SIPServer.pm => bin/SIPServer | 2 +- misc/bin/sip_run.sh | 11 ++++------- misc/bin/sip_shutdown.sh | 2 -- 3 files changed, 5 insertions(+), 10 deletions(-) rename C4/SIP/SIPServer.pm => bin/SIPServer (99%) diff --git a/C4/SIP/SIPServer.pm b/bin/SIPServer similarity index 99% rename from C4/SIP/SIPServer.pm rename to bin/SIPServer index 8d5be71624..768888c3d8 100644 --- a/C4/SIP/SIPServer.pm +++ b/bin/SIPServer @@ -1,4 +1,4 @@ -package C4::SIP::SIPServer; +package SIPServer; use strict; use warnings; diff --git a/misc/bin/sip_run.sh b/misc/bin/sip_run.sh index d270544f18..14dcd56d99 100755 --- a/misc/bin/sip_run.sh +++ b/misc/bin/sip_run.sh @@ -24,11 +24,8 @@ for x in HOME PERL5LIB KOHA_CONF ; do fi; done; unset x; -# you should hard code this if you have multiple directories -# in your PERL5LIB -PERL_MODULE_DIR=$PERL5LIB -cd $PERL_MODULE_DIR/C4/SIP; -echo; +# get the bin directory from the location of this script +BINDIR="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" sipconfig=${1}; outfile=${2:-$HOME/sip.out}; @@ -37,8 +34,8 @@ errfile=${3:-$HOME/sip.err}; if [ $sipconfig ]; then echo "Running with config file located in $sipconfig" ; echo "Calling (backgrounded):"; - echo "perl ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile"; - perl ./SIPServer.pm $sipconfig >>$outfile 2>>$errfile & + echo "perl ./SIPServer $sipconfig >>$outfile 2>>$errfile"; + $BINDIR/SIPServer $sipconfig >>$outfile 2>>$errfile & else echo "Please specify a config file and try again." diff --git a/misc/bin/sip_shutdown.sh b/misc/bin/sip_shutdown.sh index 07abbce3f1..9ee5de5369 100755 --- a/misc/bin/sip_shutdown.sh +++ b/misc/bin/sip_shutdown.sh @@ -1,7 +1,5 @@ #!/bin/bash -. $HOME/.bash_profile - # this is brittle: the primary server must have the lowest PPID # this is brittle: ps behavior is very platform-specific, only tested on Debian Etch -- 2.20.1