diff --git a/tools/install.sh b/tools/install.sh old mode 100644 new mode 100755 index ec1f5ea..102f804 --- a/tools/install.sh +++ b/tools/install.sh @@ -9,14 +9,22 @@ if [ ! -z "$1" ]; then # Copy arkdaemon to /etc/init.d ,set permissions and add it to boot if [ -f /lib/lsb/init-functions ]; then - cp lsb/arkdaemon "${INSTALL_ROOT}/etc/init.d/arkmanager" - chmod +x "${INSTALL_ROOT}/etc/init.d/arkmanager" - sed -i "s|^DAEMON=\"/usr|DAEMON=\"${EXECPREFIX}|" "${INSTALL_ROOT}/etc/init.d/arkmanager" - # add to startup if the system use sysinit - if [ -x /usr/sbin/update-rc.d -a -z "${INSTALL_ROOT}" ]; then - update-rc.d arkmanager defaults + # on debian 8, sysvinit and systemd are present. If systemd is available we use it instead of sysvinit + if [[ -f /etc/systemd/system.conf ]]; then # used by systemd + cp systemd/arkdeamon.service /etc/systemd/system/arkdaemon.service + systemctl enable arkdeamon.service echo "Ark server will now start on boot, if you want to remove this feature run the following line" - echo "update-rc.d -f arkmanager remove" + echo "systemctl disable unit" + else # systemd not present, so use sysvinit + cp lsb/arkdaemon "${INSTALL_ROOT}/etc/init.d/arkmanager" + chmod +x "${INSTALL_ROOT}/etc/init.d/arkmanager" + sed -i "s|^DAEMON=\"/usr|DAEMON=\"${EXECPREFIX}|" "${INSTALL_ROOT}/etc/init.d/arkmanager" + # add to startup if the system use sysinit + if [ -x /usr/sbin/update-rc.d -a -z "${INSTALL_ROOT}" ]; then + update-rc.d arkmanager defaults + echo "Ark server will now start on boot, if you want to remove this feature run the following line" + echo "update-rc.d -f arkmanager remove" + fi fi elif [ -f /etc/rc.d/init.d/functions ]; then cp redhat/arkdaemon "${INSTALL_ROOT}/etc/rc.d/init.d/arkmanager" @@ -36,6 +44,9 @@ if [ ! -z "$1" ]; then echo "Ark server will now start on boot, if you want to remove this feature run the following line" echo "rc-update del arkmanager default" fi + elif [[ /etc/systemd/system.conf ]]; then # used by systemd + cp systemd/arkdeamon.service /etc/systemd/system/arkdaemon.service + systemctl enable arkdeamon.service fi # Create a folder in /var/log to let Ark tools write its own log files diff --git a/tools/systemd/arkdeamon.service b/tools/systemd/arkdeamon.service new file mode 100644 index 0000000..3d93a01 --- /dev/null +++ b/tools/systemd/arkdeamon.service @@ -0,0 +1,11 @@ +[Unit] +Description=Daemon to start ark server +After=network.target + +[Service] +ExecStart=/etc/init.d/arkdaemon start +ExecStop=/etc/init.d/arkdaemon stop +Type=forking + +[Install] +WantedBy=multi-user.target