Fixed error in init.d [#CLICKHOUSE-2862].

This commit is contained in:
Alexey Milovidov 2017-02-26 21:53:24 +03:00
parent 0c8fd9efc2
commit 31724e1f60

View File

@ -23,7 +23,6 @@ BINDIR=/usr/bin
CLICKHOUSE_CRONFILE=/etc/cron.d/clickhouse-server
CLICKHOUSE_CONFIG=$SYSCONFDIR/config.xml
LOCKFILE=$LOCALSTATEDIR/$PROGRAM
LOCKFILE_FD=9
RETVAL=0
CLICKHOUSE_PIDDIR=/var/run/$PROGRAM
@ -133,7 +132,7 @@ start()
rm -f $CLICKHOUSE_PIDFILE
# Lock should not be held while running child process, so we release the lock. Note: obviously, there is race condition.
# But clickhouse-server has protection from simultaneous runs with same data directory.
su -l $CLICKHOUSE_USER -s $SHELL -c "flock -u $LOCKFILE_FD; exec -a \"$PROGRAM\" \"$BINDIR/$PROGRAM\" --daemon --pid-file=\"$CLICKHOUSE_PIDFILE\" --config-file=\"$CLICKHOUSE_CONFIG\""
su -l $CLICKHOUSE_USER -s $SHELL -c "flock -u 9; exec -a \"$PROGRAM\" \"$BINDIR/$PROGRAM\" --daemon --pid-file=\"$CLICKHOUSE_PIDFILE\" --config-file=\"$CLICKHOUSE_CONFIG\""
EXIT_STATUS=$?
if [ $EXIT_STATUS -ne 0 ]; then
break
@ -294,9 +293,9 @@ esac
(
if flock -n $LOCKFILE_FD; then
if flock -n 9; then
main "$@"
else
echo "Init script is already running" && exit 1
fi
) $LOCKFILE_FD> $LOCKFILE
) 9> $LOCKFILE