Jump to content

Scheduling a docker app restart


Recommended Posts

50 minutes ago, dgallaher said:

Having a bit of an issue with one of my docker apps (deluge) where the process seems to hang occasionally. Is there an easy way I can schedule the docker app to restart regularly (say, once a day)?

User scripts plugin

 

Script would be similar to

docker restart deluge
Link to comment
  • 5 years later...

Sorry to revive an old thread, but I just had to do this and since my docker isn't auto-start, I needed to check if it was running first before restarting it....  Here is the script I used:

 

#!/bin/bash
if [ "$(docker inspect -f '{{.State.Running}}' container_name 2>/dev/null)" = "true" ]; then
docker restart container_name;
fi

 

Replace container_name with the docker name, in this case deluge...

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...