Skip to content

Commit

Permalink
Fix locking issue in SMB recycle bin cleanup and iptables scripts.
Browse files Browse the repository at this point in the history
Signed-off-by: Volker Theile <votdev@gmx.de>
  • Loading branch information
votdev committed Feb 27, 2018
1 parent 6be37d0 commit d903f25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions deb/openmediavault/debian/changelog
@@ -1,6 +1,7 @@
openmediavault (4.0.20-1) stable; urgency=low

* Replace ifquery command in 'omv-mkconf issue' script.
* Fix locking issue in SMB recycle bin cleanup and iptables scripts.
* Fix handling of file system labels containing whitespaces.

-- Volker Theile <volker.theile@openmediavault.org> Sun, 11 Feb 2018 19:54:12 +0100
Expand Down
Expand Up @@ -42,8 +42,9 @@ set -e
# Make sure that only one instance of this shell script is running at
# the same time.
LOCK_FILE=/run/openmediavault-iptables.lock
if ! mkdir "\${LOCK_FILE}" >/dev/null 2>&1; then
exit
if ! mkdir "\${LOCK_FILE}"; then
echo "Locking failed, another job is running"
exit 0
fi
trap "rm -rf \${LOCK_FILE}" 0 1 2 3 5 15
Expand Down
Expand Up @@ -47,7 +47,7 @@ xmlstarlet sel -t \
${OMV_CONFIG_FILE} | xmlstarlet unesc |
while read uuid sharedfolderref recyclemaxage; do
filename="${OMV_CRONSCRIPTS_DIR}/${OMV_SAMBA_SHARE_RECYCLE_CRONSCRIPT_PREFIX}${uuid}"
lockfile="/run/${OMV_SAMBA_SHARE_RECYCLE_CRONSCRIPT_PREFIX}${uuid}"
lockfile="/run/${OMV_SAMBA_SHARE_RECYCLE_CRONSCRIPT_PREFIX}${uuid}.lock"
sfpath=$(omv_get_sharedfolder_path "${sharedfolderref}")
recyclerepository="${sfpath}/${OMV_SAMBA_SHARE_RECYCLE_REPOSITORY}"
amin=$((${recyclemaxage} * 24 * 60))
Expand All @@ -69,7 +69,8 @@ done
# Exit if 'recyclemaxage' is zero.
[ "\${amin}" -eq "0" ] && exit 0
# Exit if another job is running.
if ! mkdir "${lockfile}" &>/dev/null; then
if ! mkdir "${lockfile}"; then
echo "Locking failed, another job is running"
exit 0
fi
# Initialize the trap to cleanup on exit.
Expand Down

0 comments on commit d903f25

Please sign in to comment.