Made changes for nonroot daemons run

Change-Id: I17a83b07b6ddb24cb01bf5cb956b67f93cbee6e7
This commit is contained in:
Igor Yozhikov 2013-12-19 17:49:23 +04:00
parent a512ae2314
commit ed52d5843b
4 changed files with 29 additions and 7 deletions

View File

@ -31,9 +31,9 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC="murano-api"
NAME=murano-api
DAEMON=$(which murano-api)
PIDFILE=/var/run/$NAME.pid
PIDFILE=/var/run/murano/$NAME.pid
SCRIPTNAME=/etc/init.d/openstack-$NAME
SYSTEM_USER=root
SYSTEM_USER=murano
CONFIG_FILE=/etc/murano/murano-api.conf
LOCKFILE=/var/lock/subsys/$NAME
# Exit if the package is not installed
@ -46,6 +46,10 @@ RETVAL=0
start() {
if [ ! -d "/var/run/murano" ]; then
mkdir -p /var/run/murano
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"
RETVAL=$?
@ -95,4 +99,4 @@ case "$1" in
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac
exit $?
exit $?

View File

@ -11,15 +11,15 @@ bind_host = 0.0.0.0
# Port the bind the server to
bind_port = 8082
# Log to this file. Make sure the user has permissions to write to this file!
#log_file = /var/log/murano/murano-api.log
use_syslog=True
# Set up logging. Make sure the user has permissions to write to this file! To use syslog just set use_syslog parameter value to 'True'.
log_file = /var/log/murano/murano-api.log
use_syslog=False
syslog-log-facility=LOG_LOCAL0
[database]
#A valid SQLAlchemy connection string for the metadata database
#connection = mysql://root:password@localhost:3306/murano
connection = sqlite:///etc/murano/murano-api.sqlite
connection = sqlite:///murano.sqlite
#A boolean that determines if the database will be automatically created
auto_create = True

View File

@ -25,6 +25,7 @@ GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
#ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME"
ETC_CFG_DIR="/etc/murano"
LOG_DIR="/var/log/murano/"
DB_DIR="/var/db/murano/"
SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/murano-api.conf"
# Functions
@ -168,6 +169,14 @@ CLONE_FROM_GIT=$1
do
cp -f "$SERVICE_CONTENT_DIRECTORY/etc/murano/$file" "$ETC_CFG_DIR/$file.sample"
done
log "Creating $DB_DIR"
if [ ! -d "$DB_DIR" ]; then
mkdir -p $DB_DIR
if [ $? -ne 0 ];then
log "Can't create \"$DB_DIR\", exiting!!!"
exit 1
fi
fi
}
# searching for service executable in path

View File

@ -23,6 +23,7 @@ GIT_CLONE_DIR=`echo $SERVICE_CONTENT_DIRECTORY | sed -e "s/$SERVICE_SRV_NAME//"`
#ETC_CFG_DIR="/etc/$SERVICE_SRV_NAME"
ETC_CFG_DIR="/etc/murano"
LOG_DIR="/var/log/murano/"
DB_DIR="/var/db/murano/"
SERVICE_CONFIG_FILE_PATH="$ETC_CFG_DIR/murano-api.conf"
# Functions
@ -146,6 +147,14 @@ CLONE_FROM_GIT=$1
do
cp -f "$SERVICE_CONTENT_DIRECTORY/etc/murano/$file" "$ETC_CFG_DIR/$file.sample"
done
log "Creating $DB_DIR"
if [ ! -d "$DB_DIR" ]; then
mkdir -p $DB_DIR
if [ $? -ne 0 ];then
log "Can't create \"$DB_DIR\", exiting!!!"
exit 1
fi
fi
}
# searching for service executable in path