Use start-stop-daemon to launch, if available
This allows changing to the influxdb user if necessary.pull/1447/head
parent
7f88b8bb16
commit
81fe1912a8
|
@ -27,18 +27,12 @@ if [ -r $DEFAULT ]; then
|
||||||
source $DEFAULT
|
source $DEFAULT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x$NOFILES" == "x" ]; then
|
|
||||||
NOFILES=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $NOFILES -le 0 ]; then
|
|
||||||
NOFILES=65536
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x$STDOUT" == "x" ]; then
|
if [ "x$STDOUT" == "x" ]; then
|
||||||
STDOUT=/dev/null
|
STDOUT=/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
OPEN_FILE_LIMIT=65536
|
||||||
|
|
||||||
function pidofproc() {
|
function pidofproc() {
|
||||||
if [ $# -ne 3 ]; then
|
if [ $# -ne 3 ]; then
|
||||||
echo "Expected three arguments, e.g. $0 -p pidfile daemon-name"
|
echo "Expected three arguments, e.g. $0 -p pidfile daemon-name"
|
||||||
|
@ -102,14 +96,20 @@ case $1 in
|
||||||
exit 1 # Exit
|
exit 1 # Exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Start the daemon.
|
|
||||||
if ! ulimit -n $NOFILES >/dev/null 2>&1; then
|
# Bump the file limits, before launching the daemon. These will carry over to
|
||||||
echo -n "Cannot set the max number of open file descriptors"
|
# launched processes.
|
||||||
exit 1
|
ulimit -n $OPEN_FILE_LIMIT
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log_failure_msg "set open file limit to $OPEN_FILE_LIMIT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_success_msg "Starting the process" "$name"
|
log_success_msg "Starting the process" "$name"
|
||||||
nohup $daemon run -config $config -pidfile $pidfile > /dev/null 2>&1 &
|
if which start-stop-daemon > /dev/null 2>&1; then
|
||||||
|
start-stop-daemon --chuid influxdb:influxdb --start --quiet --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config > $STDOUT 2>&1 &
|
||||||
|
else
|
||||||
|
nohup $daemon run -config $config -pidfile $pidfile > $STDOUT 2>&1 &
|
||||||
|
fi
|
||||||
log_success_msg "$name process was started"
|
log_success_msg "$name process was started"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue