Below is the code of the systemd unit floatingserver.service:
[Unit]
Description=Floating server LimeLM service
Wants=network-online.target
After=network-online.target
[Service]
Type=forking
User=root
Group=root
ExecStart=/home/testuser/devbin/TurboFloatServer -d -silent -config="/home/testuser/dev/etc/config.xml" -pdets="/home/testuser/dev/bin/data.dat" -pidfile="/home/testuser/dev/server.pid"
PIDFile=/home/testuser/dev/server.pid
#Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl start floatingserver.service fails with:
Job for floatingserver.service failed. See "systemctl status floatingserver.service" and "journalctl -xe" for details.
systemctl status floatingserver.service
● floatingserver.service - Floating server LimeLM service
Loaded: loaded (/etc/systemd/system/floatingserver.service; disabled; vendor preset: disabled)
Active: failed (Result: protocol) since Tue 2023-08-29 15:29:45 CEST; 10s ago
Process: 14869 ExecStart=/home/testuser/dev/bin/TurboFloatServer -d -config="/home/testuser/dev/etc/config.xml" -pdets="/home/testuser/dev/bin/data.dat" -pidfile="/home/testuser/dev/server.pid" (code=exited, status=0/SUCCESS)
Main PID: 6559 (code=exited, status=1/FAILURE)
Aug 29 15:29:45 localhost.localdomain systemd[1]: Starting Floating server LimeLM service...
Aug 29 15:29:45 localhost.localdomain systemd[1]: Can't open PID file /home/testuser/dev/server.pid (yet?) after start: No such file or directory
Aug 29 15:29:45 localhost.localdomain systemd[1]: Failed to start Floating Server LimeLM service.
Aug 29 15:29:45 localhost.localdomain systemd[1]: Unit floatingserver.service entered failed state.
Aug 29 15:29:45 localhost.localdomain systemd[1]: floatingserver.service failed.
Tried many variants with timeouts and such but it always fails to have the PID file. The command TurboFloatServer -x works, but it needs to be invoked with daemonize tool in order to make it a proper daemon… which should be really handled properlly by the -d option.
Any example of a working systemd unit file service ?