Add a hopefully functional implementation

Time to test
This commit is contained in:
2021-01-10 19:50:20 -06:00
parent c3ca975e85
commit 0715707452
5 changed files with 67 additions and 8 deletions

View File

@@ -0,0 +1,16 @@
#! /bin/sh
# Find out where our server lives
# Ideally, this won't change at all over time. @redigit please keep these
# naming conventions
directory="server/{{ terraria_version }}/Linux"
echo "Syncing from $directory/"
# Now we rsync everything from that directory here, which should set us up
rsync -av "$directory"/ ./
# I'm not sure if it's just zip being zip or if it's Redigit not packing
# them properly, but I've found that the server executables tend to not have
# the right permissions
echo "Fixing permissions on server binaries"
find -maxdepth 1 -type f -iname "terrariaserver*" -exec chmod +x {} +

View File

@@ -11,7 +11,7 @@ After=network.target
User=terraria
Group=terraria
WorkingDirectory={{ terraria_home }}/%i
EnvironmentFile={{ terraria_home }}/%i/env
#EnvironmentFile={{ terraria_home }}/%i/env
PrivateUsers=true
ProtectSystem=full
ProtectHome=true
@@ -22,13 +22,10 @@ ProtectKernelModules=true
# Implies MountAPIVFS=yes
ProtectControlGroups=true
ExecStart=/bin/sh -c '/usr/bin/screen -DmS %i /usr/bin/java -Xms${JRE_XMS} -Xmx${JRE_XMX} -jar server.jar nogui'
ExecReload=/usr/bin/screen -p 0 -S %i -X eval 'stuff "reload"\\015'
ExecStart=/bin/sh -c '/usr/bin/screen -DmS %i ./TerrariaServer.bin.x86_64 -config config'
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "say Server is going down: Service was stopped"\\015'
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "save-all"\\015'
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "stop"\\015'
ExecStop=/usr/bin/screen -p 0 -S %i -X eval 'stuff "exit"\\015'
Restart=always