[PATCH] shutdown: move scripts instead of deleting them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Unlike every other rd.break=XXX breakpoint, shutdown happens *after* the
shutdown scripts are run. Furthermore, shutdown deletes the scripts
after they run.

This makes debugging tricky if you have something that's supposed to
dynamically generate shutdown scripts - they've all been deleted by the
time the 'shutdown' shell starts.

So just for the sake of clarity, move finished scripts out of the way
to $hookdir/shutdown/done rather than deleting them outright.
---
 modules.d/99shutdown/shutdown.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh
index 202ecb1..6f843f6 100755
--- a/modules.d/99shutdown/shutdown.sh
+++ b/modules.d/99shutdown/shutdown.sh
@@ -84,13 +84,14 @@ _check_shutdown() {
         [ -e "$__f" ] || continue
         ( . "$__f" $1 )
         if [ $? -eq 0 ]; then
-            rm -f $__f
+            mv -f $__f $hookdir/shutdown/done
             __s=0
         fi
     done
     return $__s
 }
 
+mkdir -p $hookdir/shutdown/done
 while _check_shutdown; do
 :
 done
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux