Skip to content

Instantly share code, notes, and snippets.

View ntanis-dev's full-sized avatar
🎯
Time is not enough.

Ntanis ntanis-dev

🎯
Time is not enough.
View GitHub Profile
@ntanis-dev
ntanis-dev / project-zomboid-watchdog.sh
Last active February 9, 2026 06:37
Project Zomboid dedicated-server watchdog: ensures the server is always running inside a GNU screen session, periodically checks for Steam Workshop mod updates via the server console, and applies them by restarting only when no players are online, otherwise it warns connected players in-game and defers the restart until the server is empty.
#!/usr/bin/env bash
set -euo pipefail
# Update the following parameters to reflect your server's setup.
START_CMD="/home/pzserver/start-server.sh"
STEAMCMD="/home/steamcmd/steamcmd.sh"
LOG_DIR="/root/Zomboid/Logs"
LOG_GLOB="*DebugLog-server.txt"
# Those parameters should be okay as they are.
@ntanis-dev
ntanis-dev / git_staged_files_size_check.sh
Last active April 28, 2025 21:33
Checks and displays the size of Git staged files. Tested in Ubuntu 22.04 LTS.
#!/bin/bash
num_files=$(git --no-pager diff --cached --name-only | wc -l)
if [ "$num_files" -eq 0 ]; then
echo -e "\033[91mERROR: You have no staged files.\033[0m"
exit 0
fi
total_size=$(git --no-pager diff --cached --name-only -z | xargs -0 du -b | awk '{total += $1} END {print total / 1024 / 1024}')