2.9 KiB
server-scripts
Useful scripts for managing servers written in Bash. Supported OS includes Debian/Ubuntu, Alpine, Arch, RHEL/Fedora/CentOS, openSUSE, Void, and Gentoo.
In the past I was using it more for maintaining my home servers, bare metal with Docker, however when I changed to k3s, I started using it less. Now I'm using this as a collection of useful scripts that I can use when needed. Also housekeeping.sh is still useful.
housekeeping.sh
Unified system housekeeping script for package index updates, system cleanup, and oh-my-zsh updates.
Subcommands:
update- detects the running OS and updates the package index only. It does not upgrade or install packages.clean- runs system cleanup for Docker resources, package manager caches, temporary/cache/log directories, systemd journal, thumbnails, and memory caches.omz- updates oh-my-zsh whenomzis installed; otherwise it skips safely.all- runsupdate, thenclean, thenomz. This is the default when no subcommand is provided.
The update subcommand supports Alpine, Arch, Debian/Ubuntu, RHEL/Fedora/CentOS, openSUSE, Void, and Gentoo family distributions.
Run with curl | bash:
curl -sSL https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/housekeeping.sh | bash
Run a specific subcommand:
curl -sSL https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/housekeeping.sh | bash -s -- clean
windows-backup.ps1
This PowerShell script is used to backup files from a Windows machine to a remote Samba server. It uses 7zip to create the zip file, and then sends over the network using SMB protocol.
dns-override.sh
Aggressive, best-effort DNS override script for Linux hosts with support for multiple resolver stacks (systemd-resolved, NetworkManager, resolvconf/openresolv, dhclient, systemd-networkd, and ifupdown) plus direct /etc/resolv.conf writes.
It prompts for:
- 2 required DNS servers
- 1 optional third DNS server
Validation/features:
- Accepts IPv4 and IPv6 literals
- Rejects invalid or duplicate entries
- Performs reachability checks (warn-only, does not block execution)
- Can optionally lock
/etc/resolv.confwithchattr +i
Run with curl | bash:
curl -sSL https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/dns-override.sh | bash
Important notes:
- Requires interactive TTY input (prompts are read from
/dev/tty) - Requires root privileges (
sudois used/re-execed when possible) - Script is intentionally aggressive and may restart/reload network services
- On heavily managed systems (custom agents, immutable images, enterprise policy), behavior is still best-effort
Haven Notify
It's a small internal service designed to send notifications to a specified Discord channel via webhooks. It's written in Go and can be easily deployed.
The project is defined on /haven-notify folder.