Updated init.d and systemd scripts.

This commit is contained in:
Markus Makela 2015-05-11 06:19:06 +03:00
parent 63060d1233
commit 2b457bf372
5 changed files with 27 additions and 12 deletions

View File

@ -1,7 +1,4 @@
# Set the install layout
# Possible values:
# STANDALONE - Installs to /usr/local
# PACKAGE - Installs to /usr
include(GNUInstallDirs)
set(MAXSCALE_LIBDIR ${CMAKE_INSTALL_LIBDIR}/maxscale CACHE PATH "Library installation path")
@ -9,5 +6,7 @@ set(MAXSCALE_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Executable installation
set(MAXSCALE_SHAREDIR ${CMAKE_INSTALL_DATADIR}/maxscale CACHE PATH "Share file installation path, includes licence and readme files")
set(MAXSCALE_DOCDIR ${CMAKE_INSTALL_DOCDIR}/maxscale CACHE PATH "Documentation installation path, text versions only")
set(MAXSCALE_CONFDIR ${CMAKE_INSTALL_SYSCONFDIR} CACHE PATH "Configuration file installation path, this is not usually needed")
# This is the only hard-coded absolute path
set(MAXSCALE_VARDIR /var CACHE PATH "Data file path (usually /var/)")

View File

@ -21,7 +21,7 @@
# MaxScale PIDFILE and LIB
#############################################
export MAXSCALE_PIDFILE=/var/run/maxscale/maxscale.pid
export MAXSCALE_PIDFILE=@MAXSCALE_VARDIR@/run/maxscale/maxscale.pid
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@/maxscale
###############################
@ -55,7 +55,7 @@ start() {
CHECK_RET=$?
[ $CHECK_RET -eq 0 ] && echo -n " found $my_check" && success && CHECK_RET=0
daemon --pidfile $MAXSCALE_PIDFILE @CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale >& /dev/null
daemon --pidfile $MAXSCALE_PIDFILE @CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale --user=maxscale >& /dev/null
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename

View File

@ -4,7 +4,7 @@ After=network.target
[Service]
Type=forking
PIDFile=/var/run/maxscale/maxscale.pid
PIDFile=@MAXSCALE_VARDIR@/run/maxscale/maxscale.pid
ExecStart=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale
[Install]

View File

@ -1,9 +1,25 @@
#!/bin/sh
mkdir -p /var/log/maxscale
mkdir -p /var/cache/maxscale
mkdir -p /var/run/maxscale
mkdir -p @CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHARE_DIR@/
# Create directories
mkdir -p @MAXSCALE_LIBDIR@
mkdir -p @MAXSCALE_BINDIR@
mkdir -p @MAXSCALE_SHAREDIR@
mkdir -p @MAXSCALE_DOCDIR@
mkdir -p @MAXSCALE_CONFDIR@
mkdir -p @MAXSCALE_VARDIR@/log/maxscale
mkdir -p @MAXSCALE_VARDIR@/lib/maxscale
mkdir -p @MAXSCALE_VARDIR@/cache/maxscale
mkdir -p @MAXSCALE_VARDIR@/run/maxscale
# Create MaxScale user
if [ -f "/etc/passwd" -a "$(grep -c 'maxscale' /etc/passwd)" -eq 0 ]
then
useradd -s -r /bin/false maxscale
groupadd maxscale
fi
# Copy init.d script and ldconfig file
cp @CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHAREDIR@/maxscale /etc/init.d/
cp @CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHAREDIR@/maxscale.conf /etc/ld.so.conf.d/
/sbin/ldconfig

View File

@ -21,7 +21,7 @@
# MaxScale HOME, PIDFILE, LIB
#############################################
export MAXSCALE_PIDFILE=/var/run/maxscale/maxscale.pid
export MAXSCALE_PIDFILE=@MAXSCALE_VARDIR@/run/maxscale/maxscale.pid
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@/maxscale
###############################
@ -44,7 +44,7 @@ _RETVAL_STATUS_NOT_RUNNING=3
# stop/start/status related vars
#################################
NAME=maxscale
DAEMON=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale
DAEMON=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_BINDIR@/maxscale --user=maxscale
# Source function library.
. /lib/lsb/init-functions