Add --log-file to each daemon init script
Change-Id: I3eddd5c99ad82ce58cccf6c13b89d60f8aecbffc Closes-Bug: 1330982
This commit is contained in:
@@ -31,6 +31,7 @@ NAME=murano-api
|
||||
DAEMON=$(which murano-api)
|
||||
PIDFILE=/var/run/murano/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
DAEMONLOG=/var/log/murano/$NAME.log
|
||||
SYSTEM_USER=murano
|
||||
CONFIG_FILE=/etc/murano/murano.conf
|
||||
# Exit if the package is not installed
|
||||
@@ -48,7 +49,7 @@ do_start()
|
||||
chown -R $SYSTEM_USER /var/run/murano
|
||||
fi
|
||||
start-stop-daemon --start --background --quiet --chuid $SYSTEM_USER:$SYSTEM_USER --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test -- --config-file=$CONFIG_FILE > /dev/null || return 1
|
||||
start-stop-daemon --start --background --quiet --chuid $SYSTEM_USER:$SYSTEM_USER --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- --config-file=$CONFIG_FILE || return 2
|
||||
start-stop-daemon --start --background --quiet --chuid $SYSTEM_USER:$SYSTEM_USER --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- --config-file=$CONFIG_FILE --log-file=$DAEMONLOG || return 2
|
||||
}
|
||||
|
||||
do_stop()
|
||||
|
||||
@@ -33,6 +33,7 @@ NAME=murano-api
|
||||
DAEMON=$(which murano-api)
|
||||
PIDFILE=/var/run/murano/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
DAEMONLOG=/var/log/murano/$NAME.log
|
||||
SYSTEM_USER=murano
|
||||
CONFIG_FILE=/etc/murano/murano.conf
|
||||
LOCKFILE=/var/lock/subsys/$NAME
|
||||
@@ -51,7 +52,7 @@ start() {
|
||||
chown -R $SYSTEM_USER /var/run/murano
|
||||
fi
|
||||
echo -n "Starting $NAME: "
|
||||
daemon --user $SYSTEM_USER "$DAEMON --config-file=$CONFIG_FILE &>/dev/null & echo \$! > $PIDFILE"
|
||||
daemon --user $SYSTEM_USER "$DAEMON --config-file=$CONFIG_FILE --log-file=$DAEMONLOG &>/dev/null & echo \$! > $PIDFILE"
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch $LOCKFILE
|
||||
|
||||
@@ -31,6 +31,7 @@ NAME=murano-engine
|
||||
DAEMON=$(which murano-engine)
|
||||
PIDFILE=/var/run/murano/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
DAEMONLOG=/var/log/murano/$NAME.log
|
||||
SYSTEM_USER=murano
|
||||
CONFIG_FILE=/etc/murano/murano.conf
|
||||
# Exit if the package is not installed
|
||||
@@ -48,7 +49,7 @@ do_start()
|
||||
chown -R $SYSTEM_USER /var/run/murano
|
||||
fi
|
||||
start-stop-daemon --start --background --quiet --chuid $SYSTEM_USER:$SYSTEM_USER --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test -- --config-file=$CONFIG_FILE > /dev/null || return 1
|
||||
start-stop-daemon --start --background --quiet --chuid $SYSTEM_USER:$SYSTEM_USER --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- --config-file=$CONFIG_FILE || return 2
|
||||
start-stop-daemon --start --background --quiet --chuid $SYSTEM_USER:$SYSTEM_USER --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- --config-file=$CONFIG_FILE --log-file=$DAEMONLOG || return 2
|
||||
}
|
||||
|
||||
do_stop()
|
||||
|
||||
@@ -33,6 +33,7 @@ NAME=murano-engine
|
||||
DAEMON=$(which murano-engine)
|
||||
PIDFILE=/var/run/murano/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
DAEMONLOG=/var/log/murano/$NAME.log
|
||||
SYSTEM_USER=murano
|
||||
CONFIG_FILE=/etc/murano/murano.conf
|
||||
LOCKFILE=/var/lock/subsys/$NAME
|
||||
@@ -51,7 +52,7 @@ start() {
|
||||
chown -R $SYSTEM_USER /var/run/murano
|
||||
fi
|
||||
echo -n "Starting $NAME: "
|
||||
daemon --user $SYSTEM_USER "$DAEMON --config-file=$CONFIG_FILE &>/dev/null & echo \$! > $PIDFILE"
|
||||
daemon --user $SYSTEM_USER "$DAEMON --config-file=$CONFIG_FILE --log-file=$DAEMONLOG &>/dev/null & echo \$! > $PIDFILE"
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch $LOCKFILE
|
||||
|
||||
9
setup.sh
9
setup.sh
@@ -240,11 +240,13 @@ function inject_init()
|
||||
get_service_exec_path $DAEMON || exit $?
|
||||
eval src_init_sctipt="$DAEMON-$_dist"
|
||||
_initscript="$DAEMON"
|
||||
_logfile="$(echo $DAEMON_LOG_DIR/${DAEMON}.log)"
|
||||
cp -f "$RUN_DIR/etc/init.d/$src_init_sctipt" "/etc/init.d/$_initscript" || retval=$?
|
||||
chmod +x "/etc/init.d/$_initscript" || retval=$?
|
||||
iniset '' 'SYSTEM_USER' "$DAEMON_USER" "/etc/init.d/$_initscript"
|
||||
iniset '' 'DAEMON' "$(shslash $SERVICE_EXEC_PATH)" "/etc/init.d/$_initscript"
|
||||
iniset '' 'SCRIPTNAME' "$(shslash "/etc/init.d/$_initscript")" "/etc/init.d/$_initscript"
|
||||
iniset '' 'DAEMONLOG' "$(shslash $_logfile)" "/etc/init.d/$_initscript"
|
||||
case $_dist in
|
||||
"debian")
|
||||
update-rc.d $_initscript defaults || retval=$?
|
||||
@@ -343,11 +345,12 @@ function install_daemon()
|
||||
daemon_conf="$(echo $DAEMON_CFG_DIR/${DAEMON_NAME}.conf | sed 's/-api//')"
|
||||
daemon_conf_paste="$(echo $DAEMON_CFG_DIR/${DAEMON_NAME}-paste.ini | sed 's/-api//')"
|
||||
daemon_log="$(echo $DAEMON_LOG_DIR/${DAEMON_NAME}.log | sed 's/-api//')"
|
||||
mv -f $DAEMON_CFG_DIR/${DAEMON_NAME}.conf $daemon_conf
|
||||
mv -f $DAEMON_CFG_DIR/${DAEMON_NAME}-paste.ini $daemon_conf_paste
|
||||
#mv -f $DAEMON_CFG_DIR/${DAEMON_NAME}.conf $daemon_conf
|
||||
#mv -f $DAEMON_CFG_DIR/${DAEMON_NAME}-paste.ini $daemon_conf_paste
|
||||
#
|
||||
log "Setting log file and sqlite db placement..."
|
||||
iniset 'DEFAULT' 'log_file' "$(shslash $daemon_log)" "$daemon_conf"
|
||||
sed -i '/log_file=/s/^/#/' $daemon_conf
|
||||
#iniset 'DEFAULT' 'log_file' "$(shslash $daemon_log)" "$daemon_conf"
|
||||
iniset 'DEFAULT' 'verbose' 'True' "$daemon_conf"
|
||||
iniset 'DEFAULT' 'debug' 'True' "$daemon_conf"
|
||||
iniset 'rabbitmq' 'virtual_host' '/' "$daemon_conf"
|
||||
|
||||
Reference in New Issue
Block a user