From 1fd2cecb7a29368cfdb7fb1d05c3f031b7e5eb73 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 25 Nov 2023 10:42:57 -0600 Subject: [PATCH] only run migration if conf exists redirect stderr to /dev/null Signed-off-by: Eric Nemchik --- root/migrations/02-default-location | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/migrations/02-default-location b/root/migrations/02-default-location index 9f73176..5d3d0ee 100644 --- a/root/migrations/02-default-location +++ b/root/migrations/02-default-location @@ -5,7 +5,7 @@ DEFAULT_CONF="/config/nginx/site-confs/default.conf" OLD_ROOT="root /app/grocy/public;" NEW_ROOT="root /app/www/public;" -if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}"; then +if [[ -f "${DEFAULT_CONF}" ]] && grep -q "${OLD_ROOT}" "${DEFAULT_CONF}" 2>/dev/null; then echo "updating root in ${DEFAULT_CONF}" sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}" fi