I switched to Ubuntu 16.04 LTS and had to rewrite my JTS3ServerMod boot script. Sry it was a little bit too late. First I created one and then "oh ... lets search in the forum"
(So it is tested for Ubuntu 16.04 LTS)
So I found two ways to start the bot. Each one has its benefits:
First way:Execute is by using the new jts3servermod_startscript.sh from Stefan
Pro:
- Uses technology from stefan
Con:
- Is not having any benefits from SystemD
Code:
[Unit]
Description=JTS3Servermod
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target mysql.service
Before=shutdown.target reboot.target halt.target
[Service]
WorkingDirectory=/home/tsbots/JTS3ServerMod_HostingEdition/
ExecStart=/home/tsbots/JTS3ServerMod_HostingEdition/jts3servermod_startscript.sh start
ExecStop=/home/tsbots/JTS3ServerMod_HostingEdition/jts3servermod_startscript.sh stop
Type=oneshot
User=tsbots
Group=tsbots
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Second way (my prefered):Execut is directly by using java command
Pro:
- Benefits like "Restart" is possible and used (as soon as the service stopps without systemd stop command it restarts again)
Code:
[Unit]
Description=JTS3Servermod
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target mysql.service
[Service]
PIDFile=/home/tsbots/JTS3ServerMod_HostingEdition/jts3servermod.pid
WorkingDirectory=/home/tsbots/JTS3ServerMod_HostingEdition/
ExecStart=/usr/bin/java -Xms1G -Xmx3G -jar JTS3ServerMod.jar
Type=simple
Restart=always
RestartSec=15
User=tsbots
Group=tsbots
[Install]
WantedBy=multi-user.target
Maybe someone is interested in this code - I use the upper one for all my programs/tools which already have good old sysvinit start scripts (never change a running system)