From acd0ce1a83c8a9d4f8014a2897f03b31815a13dd Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 19 Jul 2013 17:51:30 -0300 Subject: [PATCH] Bug 10617 - koha-common init script cleanup Removed unused stuff, added a new config file /etc/default/koha-common to control the init script behaviour. Currently is only a stub. The config file could be put on /etc/sysconfig on RedHat and friends. The init script should work them too. Added a TODO comment regarding the 'status' switch. To test: - Apply the patch on master, build your own packages and install. - The init script should continue to work as expected. (it can be tested replacing the /etc/init.d/koha-common file with debian/koha-common.init on a packages install). - The absence of the /etc/default/koha-common file should not prevent the init script from working. Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Robin Sheat Signed-off-by: Galen Charlton (cherry picked from commit 213fbdc5b40dd7638d652a8fd60f7391d0b10bb1) Signed-off-by: Tomas Cohen Arazi --- debian/koha-common.default | 3 +++ debian/koha-common.init | 33 ++++++++++++++------------------- 2 files changed, 17 insertions(+), 19 deletions(-) create mode 100644 debian/koha-common.default diff --git a/debian/koha-common.default b/debian/koha-common.default new file mode 100644 index 0000000000..d572f17d89 --- /dev/null +++ b/debian/koha-common.default @@ -0,0 +1,3 @@ +## General koha-common default options + +PERL5LIB="/usr/share/koha/lib" diff --git a/debian/koha-common.init b/debian/koha-common.init index 9a285a36ac..38eafcf030 100755 --- a/debian/koha-common.init +++ b/debian/koha-common.init @@ -18,17 +18,20 @@ # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Koha ILS" -NAME=daemonexecutablename -DAEMON=/usr/sbin/$NAME -DAEMON_ARGS="--options args" -PIDFILE=/var/run/$NAME.pid +NAME="koha-common" SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x /usr/sbin/koha-start-zebra ] || exit 0 # Read configuration variable file if it is present -# [ -r /etc/default/$NAME ] && . /etc/default/$NAME +if [ -r /etc/default/$NAME ]; then + # Debian / Ubuntu + . /etc/default/$NAME +elif [ -r /etc/sysconfig/$NAME ]; then + # RedHat / SuSE + . /etc/sysconfig/$NAME +fi # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh @@ -84,18 +87,6 @@ case "$1" in *) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; -# status) -# status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? -# ;; - #reload|force-reload) - # - # If do_reload() is not implemented then leave this commented out - # and leave 'force-reload' as an alias for 'restart'. - # - #log_daemon_msg "Reloading $DESC" "$NAME" - #do_reload - #log_end_msg $? - #;; restart|force-reload) # # If the "reload" option is implemented then remove the @@ -117,9 +108,13 @@ case "$1" in ;; esac ;; +# TODO: Implement this. It should check every daemon is running +# status) +# status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? +# ;; *) - echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - #echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + #echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac -- 2.39.5