Sign in to follow this  
Followers 0

Let the init system handle starting and restarting Arma Server

1 post in this topic

Most flavors of linux today use systemd init system to automatically start up applications. We, too, can use systemd to automatically start Arma 3 Server, and keep it running even after restarts and unexpected crashes. We will configure systemd to automatically start Arma 3 Server when the machine boots up, and restart it any time the process dies. This will tie in very nicely with Exile's automatic restarts.

For simplicity, let's create a start up script that will hold all the necessary parameters to start Arma 3 Server. (We are assuming Arma 3 Server is installed into /opt/exile-server)

$ cd /opt/exile-server
$ mkdir logs
$ vi

/opt/exile-server/arma3server \
    -mod="@Exile" \
    -serverMod="@ExileServer" \
    -config="@ExileServer/config.cfg" \
    -cfg="@ExileServer/basic.cfg" \
    -autoinit \
    1>>"/opt/exile-server/logs/server.log" \

Here I have created a bash script that will start Arma 3 Server (located in /opt/exile-server) running Exile mod. I have redirected the stdout (1>>) and errout(2>>) to append to a log* file inside of a logs directory that I created. The command is broken into multiple lines for easy viewing, but that's not necessary.

Now, lets create the systemd unit file that will manage Arma Server.

  • In Ubuntu or Debian, the unit file will be /lib/systemd/system/exile.service
  • In CentOS or RedHat, the unit file will be /etc/systemd/system/exile.service
Description=ArmA 3 Exile Server


ExecStart=/bin/sh /opt/exile-server/

This Unit file tells systemd to manage a service. The service will be started when linux is in multi-user mode (runlevel 4) and after networking has been started. systemd will start Arma 3 Server by executing the ExecStart (our bash script) running as steam. Any time the server is no longer running, systemd will re-start the service, except where you explicitly stopped the service. You must have WorkingDirectory set to the directory where arma3server is installed.

You can now manage the service using systemd.

$ sudo systemctl start exile.service
$ sudo systemctl restart exile.service
$ sudo systemctl stop exile.service

If you have configured Exile to automatically restart, then Arma 3 Server will shutdown after x time, and systemd will automatically start it back up. No human interaction required.

* Be careful, your log files can quickly grow to huge sizes, especially when adding more mods. I highly recommend using some sort of log rotation like logrotate.

Edited by LTHardy

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.