Have systemd (and upstart) run the script as the user

This commit is contained in:
Ben Peddell 2016-02-02 04:02:21 +10:00
parent e560db7914
commit fbd75687da
3 changed files with 6 additions and 3 deletions

View File

@ -215,7 +215,7 @@ else
cp systemd/arkmanager.service "${INSTALL_ROOT}/etc/systemd/system/arkmanager.service"
sed -i "s|=/usr/libexec/arkmanager/|=${LIBEXECDIR}/|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager.service"
cp systemd/arkmanager@.service "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
sed -i "s|=/usr/bin/|=${BINDIR}/|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
sed -i "s|=/usr/bin/|=${BINDIR}/|;s|=steam$|=${steamcmd_user}|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
if [ -z "${INSTALL_ROOT}" ]; then
systemctl daemon-reload
systemctl enable arkmanager.service
@ -243,7 +243,7 @@ else
cp systemd/arkmanager.service "${INSTALL_ROOT}/etc/systemd/system/arkmanager.service"
sed -i "s|=/usr/libexec/arkmanager/|=${LIBEXECDIR}/|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager.service"
cp systemd/arkmanager@.service "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
sed -i "s|=/usr/bin/|=${BINDIR}/|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
sed -i "s|=/usr/bin/|=${BINDIR}/|;s|=steam$|=${steamcmd_user}|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
if [ -z "${INSTALL_ROOT}" ]; then
systemctl daemon-reload
systemctl enable arkmanager.service
@ -277,7 +277,7 @@ else
cp systemd/arkmanager.service "${INSTALL_ROOT}/etc/systemd/system/arkmanager.service"
sed -i "s|=/usr/libexec/arkmanager/|=${LIBEXECDIR}/|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager.service"
cp systemd/arkmanager@.service "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
sed -i "s|=/usr/bin/|=${BINDIR}/|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
sed -i "s|=/usr/bin/|=${BINDIR}/|;s|=steam$|=${steamcmd_user}|" "${INSTALL_ROOT}/etc/systemd/system/arkmanager@.service"
if [ -z "${INSTALL_ROOT}" ]; then
systemctl daemon-reload
systemctl enable arkmanager.service

View File

@ -2,5 +2,6 @@
Description=Daemon to start an ark server instance
[Service]
User=steam
ExecStart=/usr/bin/arkmanager useconfig %i run
Type=simple

View File

@ -2,6 +2,8 @@ description "ARK Server Tools service"
instance $service
setuid steam
env DAEMON="/usr/bin/arkmanager"
exec "$DAEMON" useconfig $service run