We build the following service on redhat machine version 7.2
more king.service
[Unit]
Description=king Daemon
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
ExecStart=/opt/home/king/king-server-0.216/bin/launcher start
ExecStop=/opt/home/king/king-server-0.216/bin/launcher stop
Type=forking
PIDFile=/opt/home/king/data/var/run/launcher.pid
Restart=always
RestartSec=10
StartLimitInterval=400
StartLimitBurst=5
[Install]
WantedBy=multi-user.target
Now we stopped the service
systemctl stop king.service
now we check the status of king service
systemctl status king.service
● king.service - king Daemon
Loaded: loaded (/etc/systemd/system/king.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2019-03-28 10:39:23 UTC; 35s ago
Process: 26595 ExecStop=/opt/home/king/king-server-0.216/bin/launcher stop (code=exited, status=0/SUCCESS)
Process: 26300 ExecStart=/opt/home/king/king-server-0.216/bin/launcher start (code=exited, status=0/SUCCESS)
Main PID: 26306 (code=exited, status=143)
So service is down
Now , we start the script itself - /opt/home/king/king-server-0.216/bin/launcher start ( instead to do it from the service )
/opt/home/king/king-server-0.216/bin/launcher status
Running as 27286
Before I continue , as I understanding now we should see the service is up , because we start the script
But when we check the service we see that service still down , in spite the script is running
systemctl status king.service
● king.service - king Daemon
Loaded: loaded (/etc/systemd/system/king.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2019-03-28 10:39:23 UTC; 35s ago
Process: 26595 ExecStop=/opt/home/king/king-server-0.216/bin/launcher stop (code=exited, status=0/SUCCESS)
Process: 26300 ExecStart=/opt/home/king/king-server-0.216/bin/launcher start (code=exited, status=0/SUCCESS)
Main PID: 26306 (code=exited, status=143)
So why service not follow according to the script ?
Where I am wrong here?