#!/bin/sh

# errors shouldn't cause script to exit
set +e

if [ "$1" = "0" ] ; then
    # uninstall
    if [ -f /etc/init/shiny-server.conf ]
    then
        sudo initctl stop shiny-server 2>/dev/null
    elif [ -f /etc/systemd/system/shiny-server.service ]
    then
      systemctl stop shiny-server 2>/dev/null
    elif [ -f /etc/init.d/shiny-server ]
    then
        sudo service shiny-server stop 2>/dev/null
    fi
fi

# clear error termination state
set -e
