File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -226,8 +226,12 @@ BEFORE_HOOK_CMD=""
226226# last command.
227227# This option does not have any effect if CUSTOM_HOOK is set to 0
228228# Use NAME for a friendly name, CMD for the command itself.
229+ # Set EXECUTE_BEFORE_SPINDOWN to 1, if you have hd-idle configured
230+ # to spin down your disks in the end and want the custom hook to be
231+ # executed before that. Default is execution after spindown.
229232AFTER_HOOK_NAME=" "
230233AFTER_HOOK_CMD=" "
234+ EXECUTE_BEFORE_SPINDOWN=0
231235
232236# ###################### USER CONFIGURATION END #######################
233237
Original file line number Diff line number Diff line change @@ -311,6 +311,12 @@ if [ "$SNAP_STATUS" -eq 1 ]; then
311311 fi
312312fi
313313
314+ # Custom Hook - After (if executed before drive spin down)
315+ if [ " $CUSTOM_HOOK " -eq 1 ] && [ " $EXECUTE_BEFORE_SPINDOWN " -eq 1 ]; then
316+ echo " ### Custom Hook - [$AFTER_HOOK_NAME ]" ;
317+ bash -c " $AFTER_HOOK_CMD "
318+ fi
319+
314320# Spin down disks (Method hd-idle - spins down all rotational devices)
315321# NOTE: Uses hd-idle rewrite
316322
332338 fi
333339
334340 # Custom Hook - After
335- if [ " $CUSTOM_HOOK " -eq 1 ]; then
341+ if [ " $CUSTOM_HOOK " -eq 1 ] && [ " $EXECUTE_BEFORE_SPINDOWN " -ne 1 ] ; then
336342 echo " ### Custom Hook - [$AFTER_HOOK_NAME ]" ;
337343 bash -c " $AFTER_HOOK_CMD "
338344 fi
You can’t perform that action at this time.
0 commit comments