mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-14 19:48:27 +00:00
add systemd unit file and update install to use it
This commit is contained in:
parent
9c633d045a
commit
446147982f
25
tools/install.sh
Normal file → Executable file
25
tools/install.sh
Normal file → Executable file
@ -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
|
||||
|
||||
11
tools/systemd/arkdeamon.service
Normal file
11
tools/systemd/arkdeamon.service
Normal file
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user