Hello how do i create a minecraft server restart script
I found several for debian 8 and CentOs but not for ubunto 04/18
Those for Debian should probably also run on ubuntu, since Ubuntu is based on Debian.
No already tried it
Is there an error message? And what does the script look like?
Moment i'm looking for it
Here is the basic script there's an error message with bin bash:
#! / bin / bash
BINDIR = $ (dirname "$ (readlink -fn" $ 0 ")")
cd "$ BINDIR"
echo "\ 033] 0; lobby1 \ 007"
while true
do
java -Xms2g -Xmx2g -jar spigot.jar
echo 'If you want to stop the server completely, press CTRL-C, \ nbefore the time is 1!'
echo "Rebooting in:"
for i in 5 4 3 2 1
do
echo "$ i…"
sleep 1
done
echo 'restart server!'
That's one thing for debian i'm not the only one who says it doesn't work on ubunto
https://wiki.ubuntuusers.de/Howto/systemd_Service_Unit_Beispiel/
Create a service that restarts automatically
minecraft.service
[Unit]
 Description = Minecraft Server
 Documentation =
Wants = network.target
 After = network.target
[Service]
 User = minecraft
 Group = minecraft
 Nice = 5
 EnvironmentFile = - / var / minecraft / unit.conf
 KillMode = none
 SuccessExitStatus = 0 1
ProtectHome = true
 ProtectSystem = full
 PrivateDevices = true
 NoNewPrivileges = true
 PrivateTmp = true
 InaccessibleDirectories = / root / sys / srv - / opt / media - / lost + found
 ReadWriteDirectories = / var / minecraft / server
 WorkingDirectory = / var / minecraft / server
 ExecStart = / usr / bin / java -Xmx1024M -Xms1024M -jar spigot.jar --noconsole
 ExecStop = / var / minecraft / mcrcon -H localhost -P $ port -p $ password stop
 Restart = Always
[Install]
 WantedBy = multi-user.target
Here are complete instructions… You can omit the installation if you already have it.
https://teilgedanken.de/Blog/post/setting-up-a-minecraft-server-using-systemd/
Sudo systemctl restart minecraft.service