Ensure the trigger file to be removed
authorJoey Schulze <joey@infodrom.org>
Thu, 20 Dec 2018 16:37:21 +0000 (17:37 +0100)
committerJoey Schulze <joey@infodrom.org>
Thu, 20 Dec 2018 16:37:21 +0000 (17:37 +0100)
bin/musiikki-rescan

index 0c912b8..b7316e2 100755 (executable)
@@ -21,9 +21,13 @@ fi
 # during this operation.
 #
 
 # during this operation.
 #
 
-if [ -f "${rescan_file}" -a "${rescan_file}" -nt "${cache}" ]
+if [ -f "${rescan_file}" ]
 then
 then
-    rm "${rescan_file}"
-    /usr/sbin/minidlnad -R
-    /usr/sbin/service minidlna restart
+    trap "rm -f ${rescan_file}" INT EXIT QUIT
+
+    if [ "${rescan_file}" -nt "${cache}" ]
+    then
+       /usr/sbin/minidlnad -R
+       /usr/sbin/service minidlna restart
+    fi
 fi
 fi