Updated to rpm package

This commit is contained in:
Torkel Ödegaard 2015-04-10 17:32:40 +02:00
parent d32c03ed11
commit c44248440e
2 changed files with 9 additions and 24 deletions

View File

@ -1,6 +1,6 @@
FROM centos:7.0 FROM centos:latest
RUN yum install -y initscripts RUN yum install -y initscripts
ADD * /tmp/ ADD *.rpm /tmp/

View File

@ -53,37 +53,21 @@ fi
# overwrite settings from default file # overwrite settings from default file
[ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME [ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
PID_FILE=/var/run/$NAME.pid DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR}"
DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} --default-data-path=${DATA_DIR} --default-log-path=${LOG_DIR} web"
# Check DAEMON exists # Check DAEMON exists
test -x $DAEMON || exit 0 test -x $DAEMON || exit 0
function pidofproc() { function isRunning() {
if [ $# -ne 3 ]; then status -p $PID_FILE $NAME > /dev/null 2>&1
echo "Expected three arguments, e.g. $0 -p pidfile daemon-name"
fi
pid=`pgrep -f $3`
local pidfile=`cat $2`
if [ "x$pidfile" == "x" ]; then
return 1
fi
if [ "x$pid" != "x" -a "$pidfile" == "$pid" ]; then
return 0
fi
return 1
} }
case "$1" in case "$1" in
start) start)
echo -n $"Starting $DESC: .... " echo -n $"Starting $DESC: .... "
pid=`pidofproc -p $PID_FILE grafana` isRunning
if [ -n "$pid" ] ; then if [ $? -eq 0 ]; then
echo "Already running." echo "Already running."
exit 2 exit 2
fi fi
@ -97,7 +81,8 @@ case "$1" in
fi fi
# Start Daemon # Start Daemon
su -s /bin/sh -c "nohup ${DAEMON_PATH} --pidfile=${DAEMON_PID} ${DAEMON_OPTS} >> $STDOUT 3>&1 &" $DAEMON_USER cd $GRAFANA_HOME
su -s /bin/sh -c "nohup ${DAEMON} ${DAEMON_OPTS} >> /dev/null 3>&1 &" $DAEMON_USER
return=$? return=$?
if [ $return -eq 0 ] if [ $return -eq 0 ]
then then