Add .paused file when server is paused (#1830)

This commit is contained in:
Kyle Stang 2022-11-17 06:45:15 -08:00 committed by GitHub
parent 8b5a3f2077
commit 2fc45d6650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -1720,6 +1720,8 @@ On startup the `server.properties` file is checked and, if applicable, a warning
The utility used to wake the server (`knock(d)`) works at network interface level. So the correct interface has to be set using the `AUTOPAUSE_KNOCK_INTERFACE` variable when using non-default networking environments (e.g. host-networking, Portainer oder NAS solutions). See the description of the variable below. The utility used to wake the server (`knock(d)`) works at network interface level. So the correct interface has to be set using the `AUTOPAUSE_KNOCK_INTERFACE` variable when using non-default networking environments (e.g. host-networking, Portainer oder NAS solutions). See the description of the variable below.
A file called `.paused` is created in `/data` directory when the server is paused and removed when the server is resumed. Other services may check for this file's existence before waking the server.
A starting, example compose file has been provided in [examples/docker-compose-autopause.yml](examples/docker-compose-autopause.yml). A starting, example compose file has been provided in [examples/docker-compose-autopause.yml](examples/docker-compose-autopause.yml).
### Enabling Autopause ### Enabling Autopause

View File

@ -21,4 +21,7 @@ if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; t
# finally pause the process # finally pause the process
logAutopauseAction "Pausing Java process" logAutopauseAction "Pausing Java process"
pkill -STOP java pkill -STOP java
# create .paused file in data directory
touch /data/.paused
fi fi

View File

@ -9,4 +9,7 @@ if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; t
logAutopauseAction "Knocked from $1, resuming Java process" logAutopauseAction "Knocked from $1, resuming Java process"
echo "$1" > /var/log/knocked-source echo "$1" > /var/log/knocked-source
pkill -CONT java pkill -CONT java
# remove .paused file from data directory
rm -f /data/.paused
fi fi