#==================================================================================================
# This systemd service file can be used to start and stop the 'Mystic Internet Service' (MIS) as  #
# a proper service module. In order for it to work correctly, it must be set to 'Type=forking'.   #
# As a forking service, it will decide if start/stop was a failure based on the returned error    #
# code of the shell script. A return of 0 will be considered success, and a return of 1 will be a #
# failure. The script will need to be launched as root in order for MIS to bind to the correct    #
# ports. Once binding is done, the MIS daemon will run only as the user who owns the MIS binary.  #
# This file is indended to work with Debian, Ubuntu, Raspbian and other debian based              #
# distributions, but may work with others as well.                                                #
#                                                                                                 #
# Be sure to set the location of your mis-start.sh and mis-stop.sh scripts in the [Service]       #
# section below.                                                                                  #
#                                                                                                 #
# For more information visit: https://vswitchzero.com/mystic-systemd                              #
#==================================================================================================

[Unit]
Description=Mystic Internet Service
After=network.target
After=systemd-user-sessions.service
After=network-online.target
#Requires=mis.socket

[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE
Type=forking
# The mis daemon needs to start as root as discussed above, or will fail to bind TCP ports.
User=mystic
# Be sure to set the correct paths and script names below:
ExecStart=@MYSTIC_DIR@/mis-start
ExecStop=@MYSTIC_DIR@/mis-stop

[Install]
WantedBy=multi-user.target