mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-09-24 11:40:38 +01:00
Only modify files in startup when they aren't mounted
This commit is contained in:
@@ -8,6 +8,10 @@ set -e
|
||||
|
||||
log_info 'IPv6 ...'
|
||||
|
||||
is_mounted() {
|
||||
awk -v p="$1" '$5 == p { found=1 } END { exit !found }' /proc/self/mountinfo
|
||||
}
|
||||
|
||||
process_folder () {
|
||||
FILES=$(find "$1" -type f -name "*.conf")
|
||||
SED_REGEX=
|
||||
@@ -26,7 +30,10 @@ process_folder () {
|
||||
do
|
||||
echo "- ${FILE}"
|
||||
TMPFILE="${FILE}.tmp"
|
||||
if sed -E "$SED_REGEX" "$FILE" > "$TMPFILE" && [ -s "$TMPFILE" ]; then
|
||||
|
||||
if is_mounted "${FILE}"; then
|
||||
echo "WARNING: skipping ${FILE} — mounted file" >&2
|
||||
elif sed -E "$SED_REGEX" "$FILE" > "$TMPFILE" && [ -s "$TMPFILE" ]; then
|
||||
mv "$TMPFILE" "$FILE"
|
||||
else
|
||||
echo "WARNING: skipping ${FILE} — sed produced empty output" >&2
|
||||
|
||||
Reference in New Issue
Block a user