scorcho99 Posted July 29, 2023 Share Posted July 29, 2023 Is there a way to do this? I'd like to perform some actions before shutdown/restart using bash scripts. Is there a way that I can hook into the existing shutdown/restart to do this? Failing that I guess I'd like to make my own shutdown script that calls the safe shutdown somehow so that I don't need a parity check on reboot. Quote Link to comment
Frank1940 Posted July 30, 2023 Share Posted July 30, 2023 (edited) In the /sbin directory, there is this command--- dated march 8, 2021: And in the forum, there is this suggestions: https://forums.unraid.net/topic/50490-solved-commands-to-start-and-stop-array/#comment-496967 The problem (as my memory serves me) is making sure that the array, Dockers and VM's are all stopped properly and that 'ArrayStopped' flag is properly written to the flash drive to achieve a 'clean' shutdown. (There are situations where the GUI buttons don't always succeed in meeting all of these requirements!) Edited July 30, 2023 by Frank1940 Quote Link to comment
Frank1940 Posted July 30, 2023 Share Posted July 30, 2023 And then there is this section of the manual: https://docs.unraid.net/unraid-os/manual/troubleshooting#unclean-shutdowns Quote Link to comment
itimpi Posted July 30, 2023 Share Posted July 30, 2023 The ‘shutdown’ command from the CLI does exactly what pressing the Shutdown button in the GUI does. The section on troubleshooting unclean shutdowns applies regardless of how the shutdown process is initiated. Quote Link to comment
scorcho99 Posted July 30, 2023 Author Share Posted July 30, 2023 So it took a little digging and another post on here, but it seems like the 'powerdown' command itself calls a script which then calls the 'stop' file which doesn't exist by default but can be created. It runs very early in the process so it should fit this use case nicely. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.