27 lines
568 B
Bash
Executable File
27 lines
568 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=common.sh
|
|
source "$SCRIPT_DIR/common.sh"
|
|
|
|
action="${1:-status}"
|
|
case "$action" in
|
|
start|stop|restart)
|
|
require_root
|
|
systemctl "$action" "$SERVICE_NAME"
|
|
;;
|
|
status)
|
|
systemctl --no-pager --full status "$SERVICE_NAME"
|
|
;;
|
|
logs)
|
|
exec journalctl -u "$SERVICE_NAME" -f
|
|
;;
|
|
health)
|
|
curl -fsS "$(health_url)"; printf '\n'
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|status|logs|health}" >&2
|
|
exit 2
|
|
;;
|
|
esac
|