Skip to content

Instantly share code, notes, and snippets.

@cdzombak
Last active November 24, 2025 20:37
Show Gist options
  • Select an option

  • Save cdzombak/dfa620c01bc69f7f419906c3b5c62800 to your computer and use it in GitHub Desktop.

Select an option

Save cdzombak/dfa620c01bc69f7f419906c3b5c62800 to your computer and use it in GitHub Desktop.
index stuff running on a Linux server to help with e.g. migrations: `curl -s https://gist.githubusercontent.com/cdzombak/dfa620c01bc69f7f419906c3b5c62800/raw/3d3cb09f9935377d22e06964df6243967c4fe503/sysindex.sh | sudo bash`
#!/usr/bin/env bash
set -uo pipefail
if [ "$EUID" -ne 0 ]; then
echo "please run as root for a complete index"
exit 1
fi
echo "systemd services"
echo "================"
find /etc/systemd/system -name '*.service' -o -name '*.mount' -o -name '*.timer' | \
while read f; do [ ! -L "$f" ] && echo "$f"; done | grep -v "snap[.-]"
echo ""
if command -v docker >/dev/null 2>&1; then
echo ""
echo "docker services"
echo "==============="
docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Label \"com.docker.compose.project\"}}"
echo ""
fi
echo ""
echo "services with /var/lib state"
echo "============================"
dirs=(
docker
lxd
lxc
libvirt
postgresql
mysql
mariadb
mongodb
redis
influxdb
jenkins
gitlab
grafana
prometheus
elasticsearch
)
for dir in "${dirs[@]}"; do
[ -d "/var/lib/$dir" ] && echo "$dir"
done
echo ""
echo ""
echo "cron"
echo "===="
echo "= /etc/crontab ="
grep -Ev '^\s*(#|$)' /etc/crontab 2>/dev/null
echo ""
echo "= /etc/cron.d/ ="
cat /etc/cron.d/* 2>/dev/null | grep -Ev '^\s*(#|$)'
echo ""
echo "= Periodic scripts ="
ls -1 /etc/cron.{hourly,daily,weekly,monthly}/ 2>/dev/null
echo ""
for user in /var/spool/cron/crontabs/*; do
[ -f "$user" ] || continue
username=$(basename "$user")
echo "= crontab: $username ="
grep -Ev '^\s*(#|$)' "$user"
echo
done
if [ -d /etc/nginx/sites-enabled ]; then
echo ""
echo "nginx"
echo "====="
sudo ls -1 /etc/nginx/sites-enabled
echo ""
fi
if [ -d /etc/letsencrypt/live ]; then
echo ""
echo "Let's Encrypt certs"
echo "==================="
sudo ls -1 /etc/letsencrypt/live
echo ""
fi
if command -v tailscale >/dev/null 2>&1; then
echo ""
echo "tailscale serve"
echo "==============="
tailscale serve status
echo ""
fi
if [ -d /srv ]; then
echo ""
echo "/srv"
echo "===="
sudo ls -1 /srv
echo ""
fi
if command -v ufw >/dev/null 2>&1; then
echo ""
echo "ufw status"
echo "=========="
ufw status
echo ""
fi
echo ""
echo "listening services"
echo "=================="
netstat -lnptu
echo ""
if command -v snap >/dev/null 2>&1; then
echo ""
echo "installed snaps"
echo "==============="
snap list
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment