From 518650fc8080c43f753debec377d0678a10b578c Mon Sep 17 00:00:00 2001 From: Dalf Date: Thu, 11 Jul 2019 17:12:54 +0200 Subject: [PATCH] working searx-docker.service --- searx-docker.service.template | 9 ++++----- start.sh | 3 +++ stop.sh | 3 +++ util.sh | 2 -- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/searx-docker.service.template b/searx-docker.service.template index 470454b..1107ed3 100644 --- a/searx-docker.service.template +++ b/searx-docker.service.template @@ -1,4 +1,4 @@ -<[Unit] +[Unit] Description=searx service Requires=docker.service After=docker.service @@ -6,12 +6,11 @@ After=docker.service [Service] Restart=always +Environment=SEARX_DIR=/usr/local/searx-docker Environment=SEARX_DOCKERCOMPOSEFILE=docker-compose.yaml -WorkingDirectory=/usr/local/searx-docker - -ExecStart=/bin/sh -c "start.sh" -ExecStop=/bin/sh -c "stop.sh" +ExecStart=/bin/sh -c "${SEARX_DIR}/start.sh" +ExecStop=/bin/sh -c "${SEARX_DIR}/stop.sh" [Install] WantedBy=multi-user.target diff --git a/start.sh b/start.sh index dbfecbf..73f1170 100755 --- a/start.sh +++ b/start.sh @@ -1,5 +1,8 @@ #!/bin/sh +BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")" +cd -- "$BASE_DIR" + . ./util.sh if grep -q "MORTY_KEY=RemplaceWithARealKey!" .env; then diff --git a/stop.sh b/stop.sh index c11628b..3c18803 100755 --- a/stop.sh +++ b/stop.sh @@ -1,5 +1,8 @@ #!/bin/sh +BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")" +cd -- "$BASE_DIR" + . ./util.sh $DOCKERCOMPOSE -f $DOCKERCOMPOSEFILE down -v diff --git a/util.sh b/util.sh index d208347..9cfd4d0 100644 --- a/util.sh +++ b/util.sh @@ -1,5 +1,3 @@ -BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")" -cd -- "$BASE_DIR" set -e DOCKERCOMPOSE=$(which docker-compose || echo "/usr/local/bin/docker-compose")