From 4d7629038d09d85c96c6cc096ebfed6c34016c7f Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Wed, 30 Sep 2015 13:05:15 +0300 Subject: [PATCH] Fix to MXS-302: https://mariadb.atlassian.net/browse/MXS-302 Added support for additional command line parameters via sysconfig files. --- Documentation/Tutorials/Administration-Tutorial.md | 6 ++++++ etc/init.d/maxscale.in | 5 ++++- etc/ubuntu/init.d/maxscale.in | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Documentation/Tutorials/Administration-Tutorial.md b/Documentation/Tutorials/Administration-Tutorial.md index 920c60f96..b6ea00964 100644 --- a/Documentation/Tutorials/Administration-Tutorial.md +++ b/Documentation/Tutorials/Administration-Tutorial.md @@ -48,6 +48,12 @@ Switch|Long Option|Description `-V`|`--version-full`|print version info and the commit ID the binary was built from `-?`|`--help`|show this help +Additional command line arguments can be passed to MaxScale with a configuration file placed at `/etc/sysconfig/maxscale` on RPM installations and `/etc/default/maxscale` file on DEB installations. Set the arguments in a variable called `MAXSCALE_OPTIONS` and remember to surround the arguments with quotes. The file should only contain environment variable declarations. + +``` +MAXSCALE_OPTIONS="--logdir=/home/maxscale/logs --piddir=/tmp --syslog=no" +``` + ### Stopping MaxScale diff --git a/etc/init.d/maxscale.in b/etc/init.d/maxscale.in index 2776d81e8..ea31e6c19 100755 --- a/etc/init.d/maxscale.in +++ b/etc/init.d/maxscale.in @@ -46,6 +46,9 @@ _RETVAL_STATUS_NOT_RUNNING=3 # Source function library. . /etc/rc.d/init.d/functions +# Source additional command line arguments. +[ -f /etc/sysconfig/maxscale ] && . /etc/sysconfig/maxscale + # we can rearrange this easily processname=maxscale servicename=maxscale @@ -87,7 +90,7 @@ start() { chmod 0755 @MAXSCALE_VARDIR@/cache/maxscale chmod 0755 @MAXSCALE_VARDIR@/run/maxscale - daemon --pidfile $MAXSCALE_PIDFILE @CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale --user=maxscale >& /dev/null + daemon --pidfile $MAXSCALE_PIDFILE @CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale --user=maxscale $MAXSCALE_OPTIONS >& /dev/null RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename diff --git a/etc/ubuntu/init.d/maxscale.in b/etc/ubuntu/init.d/maxscale.in index 95ed0bcd9..a6985b4ba 100755 --- a/etc/ubuntu/init.d/maxscale.in +++ b/etc/ubuntu/init.d/maxscale.in @@ -40,12 +40,16 @@ _RETVAL_STATUS_NOT_RUNNING=3 # Sanity checks. [ -x @CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale ] || exit $_RETVAL_NOT_INSTALLED +# Source additional command line arguments. +[ -f /etc/default/maxscale ] && . /etc/default/maxscale + ################################# # stop/start/status related vars ################################# NAME=maxscale DAEMON=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale -DAEMON_OPTS='--user=maxscale' +DAEMON_OPTS='--user=maxscale $MAXSCALE_OPTIONS' + # Source function library. . /lib/lsb/init-functions