Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure directory of pidfile exists after a restart #2297

Merged
merged 2 commits into from
Apr 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
AWS_FILE=~/aws.conf

INSTALL_ROOT_DIR=/opt/influxdb
INFLUXDB_RUN_DIR=/var/run/influxdb
INFLUXDB_LOG_DIR=/var/log/influxdb
INFLUXDB_DATA_DIR=/var/opt/influxdb
CONFIG_ROOT_DIR=/etc/opt/influxdb
Expand Down Expand Up @@ -187,8 +186,6 @@ fi
chown -R -L influxdb:influxdb $INSTALL_ROOT_DIR
chmod -R a+rX $INSTALL_ROOT_DIR

mkdir -p $INFLUXDB_RUN_DIR
chown -R -L influxdb:influxdb $INFLUXDB_RUN_DIR
mkdir -p $INFLUXDB_LOG_DIR
chown -R -L influxdb:influxdb $INFLUXDB_LOG_DIR
mkdir -p $INFLUXDB_DATA_DIR
Expand Down
11 changes: 10 additions & 1 deletion scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
# any config file values. Example: "-join http://1.2.3.4:8086"
INFLUXD_OPTS=

USER=influxdb
GROUP=influxdb

if [ -r /lib/lsb/init-functions ]; then
source /lib/lsb/init-functions
fi
Expand Down Expand Up @@ -93,6 +96,12 @@ daemon=/opt/influxdb/influxd

# pid file for the daemon
pidfile=/var/run/influxdb/influxd.pid
piddir=`dirname $pidfile`

if [ ! -d "$piddir" ]; then
mkdir -p $piddir
chown $GROUP:$USER $piddir
fi

# Configuration file
config=/etc/opt/influxdb/influxdb.conf
Expand Down Expand Up @@ -121,7 +130,7 @@ case $1 in

log_success_msg "Starting the process" "$name"
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 $INFLUXD_OPTS >>$STDOUT 2>>$STDERR &
start-stop-daemon --chuid $GROUP:$USER --start --quiet --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config $INFLUXD_OPTS >>$STDOUT 2>>$STDERR &
else
nohup $daemon -pidfile $pidfile -config $config $INFLUXD_OPTS >>$STDOUT 2>>$STDERR &
fi
Expand Down