only run migration if conf exists

redirect stderr to /dev/null

Signed-off-by: Eric Nemchik <eric@nemchik.com>
This commit is contained in:
Eric Nemchik
2023-11-25 10:42:57 -06:00
parent 95b5c12980
commit 5a13df03c2

View File

@@ -5,7 +5,7 @@ DEFAULT_CONF="/config/nginx/site-confs/default.conf"
OLD_ROOT="root /var/www/localhost/heimdall/public;" OLD_ROOT="root /var/www/localhost/heimdall/public;"
NEW_ROOT="root /app/www/public;" NEW_ROOT="root /app/www/public;"
if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}" 2>/dev/null; then if [[ -f "${DEFAULT_CONF}" ]] && grep -q "${OLD_ROOT}" "${DEFAULT_CONF}" 2>/dev/null; then
echo "updating root in ${DEFAULT_CONF}" echo "updating root in ${DEFAULT_CONF}"
sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}" sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}"
fi fi