Essentially what I am trying to understand how to do is to modify some scripts I found to run two simultaneous instances of a service on a Linux Mint machine that I had lying around.
Setting up the first instance of the service I used the instructions found here:
Now I am attempting to take these instructions and alter them to essentially create a second service using the same scripts..
The service will not start and stay that way, though it did prior to a full machine restart. I have placed the second .service file in the same place as the first, '/etc/systemd/system/'. Contents of the service file is below.
[Unit] Description=server daemon for whim [Service] Type=forking User=whim KillMode=none ExecStart=/usr/bin/screen -dmS whim /bin/bash -c "/opt/terraria/TerrariaServer.bin.x86_64 -config /opt/terraria/whimserverconfig.txt" ExecStop=/usr/local/bin/whimd exit [Install] WantedBy=multi-user.target
Now the reason I restarted the machine in the first place was yet another error. During the course of the instructions here I setup a script for basic administration. It is placed in the same location as the first. '/usr/local/bin/' Contents of the file are below.
#!/usr/bin/env bash send="`printf \"$*\r\"`" attach='script /dev/null -qc "screen -r whim"' inject="screen -S whim-X stuff $send" if [ "$1" = "attach" ] ; then cmd="$attach" ; else cmd="$inject" ; fi if [ "`stat -c '%u' /var/run/screen/S-whim/`" = "$UID" ] then $cmd else su - whim-c "$cmd" fi
The problem, before the service ceased to work, was that I could never attach to the screen for the new whim.service.
So my question is this:
Did I go wrong modifying one of these two files or am I missing something even more basic?