I have a remote server running CentOS 7 I can only access by SSH. I want two java servers running on them at all times, even after ISP does reboots etc. S
So I have tried to make a systemd service that starts the two java servers in a screen. I do not get any error messages when I start the service but it instantly dies: (systemctl status -l blogpatcher.service)
* blogpatcher.service - Start blogpatcher servers Loaded: loaded (/etc/systemd/system/blogpatcher.service; enabled; vendor preset: disabled) Active: inactive (dead) since Sat 2020-02-08 04:19:09 EST; 7s ago Process: 22388 ExecStart=/usr/bin/bash /home/blogpatc/script/blogpatcher.sh (code=exited, status=0/SUCCESS) Main PID: 22388 (code=exited, status=0/SUCCESS)
Here is blogpatcher.service file:
# vi /etc/systemd/system/blogpatcher.service [Unit] Description=Start blogpatcher servers After=network.target [Service] Type=simple ExecStart=/usr/bin/bash /home/blogpatc/script/blogpatcher.sh TimeoutStartSec=90 [Install] WantedBy=default.target
Here is the script file that the service run:
# vi /var/tmp/test_script.sh #!/bin/bash screen -dmS syn bash -c 'cd /home/blogpatc/server/;java -cp bloghelper_artifact_main.jar com.aperico.bloghelper.server.ThesaurusServer;exec bash'
If I just run the script file from SSH console it works as intended and since there is no error message I am a bit stumped and wondering if anyone knows what the problem is?