I am trying to run a run.sh script to start a game server admin panel. I created a service to run it on boot. It works fine when I type sudo systemctl start servicename.service in the console but seems like it is breaking when it is starting on boot.

Description=Name Here



scriptname_start.sh content

screen -dm bash -c 'bash /home/my/directory/run.sh +set serverProfile profilename +set Port 12345'

From the script owner's Docs

Requires to be launched from inside FXServer in monitor mode, to do that, just execute the run.sh without any +exec arguments.

Panel's Errors (The panel is running fine without the service, so i don't think it is the panel's problem)

Restarting server (server partial crash detected).
[04:46:17][FXRunner]  >> [1918] FXServer Exited.
[04:46:17][FXRunner]  >> [1918] FXServer Closed. (code null)
[04:46:19][FXRunner]  >> [2040] FXServer Started!

What can be wrong?

Thanks a lot!

PS. I'm a newbie, so the more details the better x))

journalctl --unit=fivemtxadmin.service -b

[root@server ~]# journalctl --unit=fivemtxadmin.service -b
-- Logs begin at Sun 2020-06-21 05:19:00 CEST, end at Sun 2020-06-21 05:19:23 CEST. --
Jun 21 03:19:01 server.domain.eu systemd[1]: Starting FiveM TxAdmin...
Jun 21 03:19:01 server.domain.eu systemd[1]: Started FiveM TxAdmin.

systemctl status fivemtxadmin.service

[root@server ~]# systemctl status fivemtxadmin.service

● fivemtxadmin.service - FiveM TxAdmin

   Loaded: loaded (/usr/lib/systemd/system/fivemtxadmin.service; enabled; vendor preset: disabled)

   Active: active (running) since Sun 2020-06-21 03:19:01 CEST; 2h 2min ago

  Process: 822 ExecStart=/usr/bin/fivemtxadmin_start.sh (code=exited, status=0/SUCCESS)

 Main PID: 837 (screen)

   CGroup: /system.slice/fivemtxadmin.service

           ├─ 837 /usr/bin/SCREEN -dm /bin/bash -c bash /home/username/fivem/f...

           ├─ 843 /home/username/fivem/fx-server/alpine/opt/cfx-server/ld-musl...
           └─2077 /home/username/fivem/fx-server/alpine/opt/cfx-server/ld-musl...

Jun 21 03:19:01 server.domain.eu systemd[1]: Starting FiveM TxAdmin...

Jun 21 03:19:01 server.domain.eu systemd[1]: Started FiveM TxAdmin.
  • What is the output of systemctl status servicename.service | grep Loaded:? Jun 21, 2020 at 1:45
  • Hello, it gives me this: Loaded: loaded (/usr/lib/systemd/system/fivemtxadmin.service; enabled; vendor preset: disabled) Jun 21, 2020 at 2:32
  • That's unexpected. What are the outputs of journalctl --unit=fivemtxadmin.service -b and systemctl status fivemtxadmin.service after a reboot (before manual starting of the service)? Add that to your question. Jun 21, 2020 at 3:13
  • @HaukeLaging added at the bottom of my question, thanks a lot! Jun 21, 2020 at 3:27
  • 1
    Why do you think "it is breaking when it is starting on boot"? The service is obviously running. Jun 21, 2020 at 3:39

2 Answers 2


From the information you provided it's not clear what the problem is but here are a few things you can check:

  1. After making changes to the unit files you have to run systemctl daemon-reload to trigger a reload of these files.

  2. Manually start the service by running sudo systemctl start servicename.service and verify it starts without any issues. That's the case if you don't see any output.

  3. Run systemctl status servicename.service. Verify that it reports the service as running. Also verify the service is "enabled". If that's not the case run sudo systemctl enable servicename.service to do so.

  4. Reboot the machine and check if the service is running again.

If the service fails to start, run journalctl -u servicename.service to see any log messages that have been printed by your script.

A couple of thoughts regarding your script:

  • Make sure the user you specified in the service file is allowed to execute the script.

  • Your script is not specifying a full path to the commands it calls. This path usually gets set for your shell when you log in. The PATH environment variable might not be set when a service is started during system boot so it's a good practice to use absolute path in a script like this:

    /usr/bin/screen -dm /bin/bash -c '/bin/bash /home/my/directory/run.sh +set serverProfile profilename +set Port 12345'
  • Check if your script requires any unit other than the network to be up. Maybe there's a dependency missing? If adding sleep 10 to the beginning of your script "fixes" your problem this might be the case.

  • Error messages are most likely printed by the process running under control of screen. To see them you need to attach with screen -r 837 (the PID in the output you provided above). Scroll if needed with the cursor keys after pressing Ctrl + Esc.

  • 1
    If a manual start works (as the question states) then systemctl daemon-reload can hardly be necessary. Jun 21, 2020 at 1:47
  • Hello, I did everything that you told me, also I am not getting any errors. I will try to explain a bit more what the problem is. That script is starting the server control panel which starts the game server when the panel starts on boot. When it is starting on boot it is sending the message that the server started and then a 2nd message that says the server crashed but still no error in service status. When I start it from the console it is working without any problem at all but it gives the following errors in the panel's logs. (I updated my first Post with panel's error) Jun 21, 2020 at 2:47
  • Ps. I got the full path using this: readlink -f run.sh . Is that what you're talking about? bash /home/user/directory/run.sh +set serverProfile profilename +set Port 12345 Jun 21, 2020 at 2:59

The answer to the specific problem is that i just had to use Type=idle and start the service after everything started.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .