Author Topic: Systemd Start-Script  (Read 3666 times)

UncleSam

  • JTS3ServerMod Internal
  • *****
  • Posts: 34
    • View Profile
Systemd Start-Script
« on: May 29, 2018, 10:39:14 AM »
Hi there,
if you want you can use my start/stop script for Systemd:
1. Create a new file:
Code: [Select]
/lib/systemd/system/jts3servermod.service2. Fill it like this sample:
Code: [Select]
[Unit]Description=JTS3ServermodAfter=network.target[Service]
PIDFile=/path/to/JTS3ServerMod_HostingEdition/jts3servermod.pid
WorkingDirectory=/path/to/JTS3ServerMod_HostingEdition/
ExecStart=/usr/bin/java -Xms1G -Xmx2G -jar JTS3ServerMod.jar
Type=simple
Restart=always
RestartSec=15
User=botusername
Group=botgroupname

[Install]
WantedBy=multi-user.target
Description (just of some entries):
  • Restart always: if bot was stopped for any reasons other then 'service jts3servermod stop' or 'systemctl stop jts3servermod' it starts this service again
  • RestartSec 15: if the above happens it waits 15 seconds between crash and start
  • User: linux username the bot should run under
  • Group: optional, if not used comment it using "#" or delete it
3. enable it to auto start
Code: [Select]
systemctl daemon-reload
systemctl enable jts3servermod.service
4. Have fun :-)
Code: [Select]
service jts3servermod start/stop/restartImage already added
« Last Edit: June 01, 2020, 03:19:17 PM by UncleSam »

VeLutIon

  • JTS3ServerMod Internal
  • *****
  • Posts: 3
    • View Profile
Re: Systemd Start-Script
« Reply #1 on: June 06, 2020, 01:40:43 PM »
Hi, I did it exactly as you explained it. However, I get an error. Here is the mistake. Can you help me with my problem

● jts3servermod.service
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)

Jun 06 13:33:47 VeLutIon systemd[1]: [/lib/systemd/system/jts3servermod.service:1] Unknown section 'Unit]Description=JTS3ServermodAfter=network.target[Service'. Ignoring.
Jun 06 13:33:47 VeLutIon systemd[1]: jts3servermod.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 06 13:33:49 VeLutIon systemd[1]: [/lib/systemd/system/jts3servermod.service:1] Unknown section 'Unit]Description=JTS3ServermodAfter=network.target[Service'. Ignoring.
Jun 06 13:33:49 VeLutIon systemd[1]: jts3servermod.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 06 13:36:37 VeLutIon systemd[1]: [/lib/systemd/system/jts3servermod.service:1] Unknown section 'Unit]Description=JTS3ServermodAfter=network.target[Service'. Ignoring.
Jun 06 13:36:37 VeLutIon systemd[1]: jts3servermod.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 06 13:36:47 VeLutIon systemd[1]: [/lib/systemd/system/jts3servermod.service:1] Unknown section 'Unit]Description=JTS3ServermodAfter=network.target[Service'. Ignoring.
Jun 06 13:36:47 VeLutIon systemd[1]: jts3servermod.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Jun 06 13:36:53 VeLutIon systemd[1]: [/lib/systemd/system/jts3servermod.service:1] Unknown section 'Unit]Description=JTS3ServermodAfter=network.target[Service'. Ignoring.
Jun 06 13:36:53 VeLutIon systemd[1]: jts3servermod.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.