LTHardy

Member
  • Content count

    1
  • Donations

    0.00 EUR 
  • Joined

  • Last visited

Community Reputation

1 Neutral

About LTHardy

  • Rank
    Bambi
  1. 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 start.sh #!/bin/sh /opt/exile-server/arma3server \ -mod="@Exile" \ -serverMod="@ExileServer" \ -config="@ExileServer/config.cfg" \ -cfg="@ExileServer/basic.cfg" \ -autoinit \ 1>>"/opt/exile-server/logs/server.log" \ 2>>"/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 [Unit] Description=ArmA 3 Exile Server After=network.target [Install] WantedBy=multi-user.target [Service] Type=simple User=steam Group=steam WorkingDirectory=/opt/exile-server ExecStart=/bin/sh /opt/exile-server/start.sh Restart=always 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 start.sh 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.