#!/bin/sh
# atlasd preremove — stop the service on a real uninstall, not on the remove half
# of an upgrade. Init-system-agnostic. See atlas-node-preremove.sh for the
# per-packager argument conventions.
set -e

case "${1:-}" in
	0 | remove | purge | "")
		if command -v systemctl >/dev/null 2>&1; then
			systemctl stop atlasd.service 2>/dev/null || true
		elif command -v rc-service >/dev/null 2>&1; then
			rc-service atlasd stop 2>/dev/null || true
		fi
		;;
esac

exit 0
