#!/bin/sh



NAME="jam-admin"

set -e
if [ "$1" = "remove" ]
then
	set +e
	# stop the process, if any is found. we don't want this failing to cause an error, though.
	sudo stop $NAME
  	set -e

	if [ -f /etc/init/$NAME.conf ]; then
		rm /etc/init/$NAME.conf
	fi	
fi

if [ "$1" = "purge" ]
then
	if [ -d /var/lib/$NAME ]; then
		rm -rf /var/lib/$NAME
	fi

	userdel $NAME
fi
