Compare commits

..

7 Commits

Author SHA1 Message Date
Tim Visée
37fdb9c12a
Merge pull request #54 from Spongecade/patch-1
Update Minecraft wiki links to new domain
2023-10-13 18:53:23 +02:00
Spongecade
e7a3db19aa
Update Minecraft wiki links to new domain 2023-10-05 15:26:24 -05:00
timvisee
ca4753673d
Run CI on shared GitLab runners 2023-08-20 17:33:32 +02:00
timvisee
0124aa723d
Merge branch 'Xeyler-master' into master
Refs: https://github.com/timvisee/lazymc/pull/50
2023-05-30 22:41:04 +02:00
Xeyler
afbc54758c
Update monitor.rs 2023-05-27 23:14:48 -06:00
timvisee
e54025f02f
Bump version to 0.2.10 2023-02-20 10:34:06 +01:00
timvisee
023e46fe64
Allow exit code 143 and 130
Fixes https://github.com/timvisee/lazymc/issues/26
2023-02-20 10:31:04 +01:00
8 changed files with 22 additions and 17 deletions

View File

@ -7,11 +7,6 @@ stages:
- pre-release
- release
default:
tags:
- linux
- timvisee-linux
# Variable defaults
variables:
RUST_VERSION: stable

View File

@ -1,5 +1,9 @@
# Changelog
## 0.2.10 (2023-02-20)
- Do not report an error when server exits with status code 143
## 0.2.9 (2023-02-14)
- Fix dropping all connections when `server.drop_banned_ips` was enabled

2
Cargo.lock generated
View File

@ -926,7 +926,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "lazymc"
version = "0.2.9"
version = "0.2.10"
dependencies = [
"anyhow",
"async-std",

View File

@ -1,6 +1,6 @@
[package]
name = "lazymc"
version = "0.2.9"
version = "0.2.10"
authors = ["Tim Visee <3a4fb3964f@sinenomine.email>"]
license = "GPL-3.0"
readme = "README.md"

View File

@ -187,4 +187,4 @@ command = "java -Xmx1G -Xms1G -jar server.jar --nogui"
[config]
# lazymc version this configuration is for.
# Don't change unless you know what you're doing.
version = "0.2.9"
version = "0.2.10"

View File

@ -57,13 +57,13 @@ pub async fn monitor_server(config: Arc<Config>, server: Arc<Server>) {
// Sleep server when it's bedtime
if server.should_sleep(&config).await {
info!(target: "lazymc::montior", "Server has been idle, sleeping...");
info!(target: "lazymc::monitor", "Server has been idle, sleeping...");
server.stop(&config).await;
}
// Check whether we should force kill server
if server.should_kill().await {
error!(target: "lazymc::montior", "Force killing server, took too long to start or stop");
error!(target: "lazymc::monitor", "Force killing server, took too long to start or stop");
if !server.force_kill().await {
warn!(target: "lazymc", "Failed to force kill server");
}

View File

@ -70,7 +70,7 @@ async fn send_v1_16_3(
packet::write_packet(
Title {
action: if title.is_empty() && subtitle.is_empty() {
// Defaults: https://minecraft.fandom.com/wiki/Commands/title#Detail
// Defaults: https://minecraft.wiki/w/Commands/title#Detail
TitleAction::SetTimesAndDisplay {
fade_in: 10,
stay: 70,
@ -121,7 +121,7 @@ async fn send_v1_17(
// Set title times
packet::write_packet(
if title.is_empty() && subtitle.is_empty() {
// Defaults: https://minecraft.fandom.com/wiki/Commands/title#Detail
// Defaults: https://minecraft.wiki/w/Commands/title#Detail
SetTitleTimes {
fade_in: 10,
stay: 70,

View File

@ -29,9 +29,11 @@ const SERVER_QUIT_COOLDOWN: Duration = Duration::from_millis(2500);
#[cfg(feature = "rcon")]
const RCON_COOLDOWN: Duration = Duration::from_secs(15);
/// Exit code when SIGTERM is received on Unix.
#[cfg(unix)]
const UNIX_EXIT_SIGTERM: i32 = 130;
/// Exit codes that are allowed.
///
/// - 143: https://github.com/timvisee/lazymc/issues/26#issuecomment-1435670029
/// - 130: https://unix.stackexchange.com/q/386836/61092
const ALLOWED_EXIT_CODES: [i32; 2] = [130, 143];
/// Shared server state.
#[derive(Debug)]
@ -496,8 +498,12 @@ pub async fn invoke_server_cmd(
debug!(target: "lazymc", "Server process stopped successfully ({})", status);
false
}
#[cfg(unix)]
Ok(status) if status.code() == Some(UNIX_EXIT_SIGTERM) => {
Ok(status)
if status
.code()
.map(|ref code| ALLOWED_EXIT_CODES.contains(code))
.unwrap_or(false) =>
{
debug!(target: "lazymc", "Server process stopped successfully by SIGTERM ({})", status);
false
}