Skip to content

Commit

Permalink
Fixes startup error when no containers running
Browse files Browse the repository at this point in the history
Fixing patch introduced by #1764 when docker is installed but no containers are running
  • Loading branch information
Nick Vyzas authored Jan 26, 2019
1 parent d4771a9 commit 152d059
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions etc/init.d/proxysql
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,17 @@ testpid() {
}

is_pid_child_of_docker() {
# Check if docker is installed (no point in checking if docker isn't present)
which docker &> /dev/null
if [ "$?" -eq 1 ] ; then
return 0;
fi

# Check if any docker containers are running (check required since empty output fails next command)
if [ "$(docker ps -q | wc -l)" -eq 0 ] ; then
return 0;
fi

IFS=$'\n'
docker_pids=($(docker ps -q | xargs docker inspect --format '{{.State.Pid}}'))
local child_pid=$1
Expand Down

0 comments on commit 152d059

Please sign in to comment.