dotfiles/logs
2026-04-24 20:05:22 +02:00

21 lines
352 B
Bash
Executable file

#!/bin/sh
if [ "$1" = "--user" ]; then
shift
scope="--user"
else
scope=""
fi
[ -z "$1" ] && { echo "missing service name"; exit 1; }
service="$1"
# Check if the unit exists
if ! systemctl $scope status "$service" >/dev/null 2>&1; then
echo "no such service: $service"
exit 1
fi
# Follow logs
journalctl $scope -f -u "$service"