mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
committed by
Torkel Ödegaard
parent
f2dffeb543
commit
5dad324ab7
@@ -37,14 +37,8 @@ MAX_OPEN_FILES=10000
|
|||||||
PID_FILE=/var/run/$NAME.pid
|
PID_FILE=/var/run/$NAME.pid
|
||||||
DAEMON=/usr/sbin/$NAME
|
DAEMON=/usr/sbin/$NAME
|
||||||
|
|
||||||
|
|
||||||
umask 0027
|
umask 0027
|
||||||
|
|
||||||
if [ `id -u` -ne 0 ]; then
|
|
||||||
echo "You need root privileges to run this script"
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -x $DAEMON ]; then
|
if [ ! -x $DAEMON ]; then
|
||||||
echo "Program not installed or not executable"
|
echo "Program not installed or not executable"
|
||||||
exit 5
|
exit 5
|
||||||
@@ -63,9 +57,16 @@ fi
|
|||||||
|
|
||||||
DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR} cfg:default.paths.plugins=${PLUGINS_DIR}"
|
DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR} cfg:default.paths.plugins=${PLUGINS_DIR}"
|
||||||
|
|
||||||
|
function checkUser() {
|
||||||
|
if [ `id -u` -ne 0 ]; then
|
||||||
|
echo "You need root privileges to run this script"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
checkUser
|
||||||
log_daemon_msg "Starting $DESC"
|
log_daemon_msg "Starting $DESC"
|
||||||
|
|
||||||
pid=`pidofproc -p $PID_FILE grafana`
|
pid=`pidofproc -p $PID_FILE grafana`
|
||||||
@@ -112,6 +113,7 @@ case "$1" in
|
|||||||
log_end_msg $return
|
log_end_msg $return
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
|
checkUser
|
||||||
log_daemon_msg "Stopping $DESC"
|
log_daemon_msg "Stopping $DESC"
|
||||||
|
|
||||||
if [ -f "$PID_FILE" ]; then
|
if [ -f "$PID_FILE" ]; then
|
||||||
|
|||||||
@@ -36,11 +36,6 @@ MAX_OPEN_FILES=10000
|
|||||||
PID_FILE=/var/run/$NAME.pid
|
PID_FILE=/var/run/$NAME.pid
|
||||||
DAEMON=/usr/sbin/$NAME
|
DAEMON=/usr/sbin/$NAME
|
||||||
|
|
||||||
if [ `id -u` -ne 0 ]; then
|
|
||||||
echo "You need root privileges to run this script"
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -x $DAEMON ]; then
|
if [ ! -x $DAEMON ]; then
|
||||||
echo "Program not installed or not executable"
|
echo "Program not installed or not executable"
|
||||||
exit 5
|
exit 5
|
||||||
@@ -70,8 +65,16 @@ function isRunning() {
|
|||||||
status -p $PID_FILE $NAME > /dev/null 2>&1
|
status -p $PID_FILE $NAME > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkUser() {
|
||||||
|
if [ `id -u` -ne 0 ]; then
|
||||||
|
echo "You need root privileges to run this script"
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
checkUser
|
||||||
isRunning
|
isRunning
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "Already running."
|
echo "Already running."
|
||||||
@@ -115,6 +118,7 @@ case "$1" in
|
|||||||
exit $return
|
exit $return
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
|
checkUser
|
||||||
echo -n "Stopping $DESC: ..."
|
echo -n "Stopping $DESC: ..."
|
||||||
|
|
||||||
if [ -f "$PID_FILE" ]; then
|
if [ -f "$PID_FILE" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user