mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-08-06 07:23:18 +00:00
fix multiarch autopause daemon (#722)
This commit is contained in:
@@ -15,17 +15,35 @@ autopause_error_loop() {
|
|||||||
logAutopause "Autopause failed to initialize. This log entry will be printed every 30 minutes."
|
logAutopause "Autopause failed to initialize. This log entry will be printed every 30 minutes."
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
if [[ -n $(ps -ax -o comm | grep java) ]] ; then
|
sleep 1800
|
||||||
break
|
logAutopause "Autopause failed to initialize."
|
||||||
fi
|
|
||||||
sleep 0.1
|
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# wait for java process to be started
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
if java_process_exists ; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
|
||||||
|
# check for interface existence
|
||||||
|
if [[ -z "$AUTOPAUSE_KNOCK_INTERFACE" ]] ; then
|
||||||
|
logAutopause "AUTOPAUSE_KNOCK_INTERFACE variable must not be empty!"
|
||||||
|
autopause_error_loop
|
||||||
|
fi
|
||||||
|
if ! [[ -d "/sys/class/net/$AUTOPAUSE_KNOCK_INTERFACE" ]] ; then
|
||||||
|
logAutopause "Selected interface \"$AUTOPAUSE_KNOCK_INTERFACE\" does not exist!"
|
||||||
|
autopause_error_loop
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo /usr/sbin/knockd -c /tmp/knockd-config.cfg -d -i "$AUTOPAUSE_KNOCK_INTERFACE"
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
logAutopause "Failed to start knockd daemon."
|
logAutopause "Failed to start knockd daemon."
|
||||||
logAutopause "Possible cause: docker's host network mode."
|
logAutopause "Probable cause: Unable to attach to interface \"$AUTOPAUSE_KNOCK_INTERFACE\"."
|
||||||
logAutopause "Recreate without host mode or disable autopause functionality."
|
autopause_error_loop
|
||||||
logAutopause "Stopping server."
|
|
||||||
pkill -SIGTERM java
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
STATE=INIT
|
STATE=INIT
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ java_running() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java_process_exists() {
|
java_process_exists() {
|
||||||
[[ -n "$(ps -a -o comm | grep 'java')" ]]
|
[[ -n "$(ps -ax -o comm | grep 'java')" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
rcon_client_exists() {
|
rcon_client_exists() {
|
||||||
|
|||||||
Reference in New Issue
Block a user