Jump to content

Override/Custom Shutdown Script


Go to solution Solved by JonathanM,

Recommended Posts

Is there a way for me to override the commands (or some of the commands) that Unraid runs on Stop Array/Shutdown/Reboot?

 

I have two problems I am trying to solve:

 

1. Docker container that will not SIGTERM

One of my containers for whatever reason does not respond to the stop command. I have to manually `docker kill container-name` or it blocks the shutdown forever. Even when reaching the Docker Stop Timeout it doesn't get past this. I tried a user script on stopping of array, but that event doesn't fire until after Docker is stopped.

 

2. Docker container shutdown order

Another container relies on a PGSQL container. When shutting down, it attempts to run cleanup tasks and sync information to the DB. When manually stopping docker this is not a problem. However on shutdown Unraid stops all the containers at the same time. The DB stops immediately and then the container depending on it throws errors attempting to run its own shutdown. It fails to stop and then is killed when Docker Stop Timeout has elapsed. This takes much longer than a graceful shutdown and I am concerned about what is happening to the data that it's trying to send to the DB during graceful shutdown.

 

 

If I can override the scripts that are running on shutdown (or, less ideal but still workable, run my own script before the regular shutdown script) I can resolve both of these issues by killing the one container (I'm not concerned about forced shutdown for that one) and stopping the other containers in an order of my choosing.

 

I am comfortable with bash and writing the script myself, I just need to know how I can do so.

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...