service unit:
[Unit] Description=test After=syslog.target After=network.target [Service] Type=forking ExecStart=/bin/java -jar /home/ec2-user/test.jar TimeoutSec=300 [Install] WantedBy=multi-user.target
it starts with a penalty for 1-4 minutes. But then he fails:
tail / var / log / messages:
Feb 27 18:43:44 ip-172-31-40-48 systemd: Reloading. Feb 27 18:44:06 ip-172-31-40-48 systemd: Starting test... Feb 27 18:44:06 ip-172-31-40-48 java: 5.1.73 Feb 27 18:44:06 ip-172-31-40-48 java: Starting the internal [HTTP/1.1] server on port 8182 Feb 27 18:49:06 ip-172-31-40-48 systemd: test.service operation timed out.Terminating. Feb 27 18:49:06 ip-172-31-40-48 systemd: test.service: control process exited, code=exited status=143 Feb 27 18:49:06 ip-172-31-40-48 systemd: Failed to start test. Feb 27 18:49:06 ip-172-31-40-48 systemd: Unit test.service entered failed state.
systemctl status test.service (upon restart, in activation mode):
test.service - Setsnew Loaded: loaded (/etc/systemd/system/test.service; enabled) Active: activating (start) since Sun 2015-03-01 14:29:36 EST; 2min 30s ago Control: 32462 (java) CGroup: /system.slice/test.service
systemctl status test.service (after failure):
test.service - test Loaded: loaded (/etc/systemd/system/test.service; enabled) Active: failed (Result: exit-code) since Fri 2015-02-27 18:49:06 EST; 18min ago Process: 27954 ExecStart=/bin/java -jar /home/ec2-user/test.jar (code=exited, status=143)
- when running jar on the command line it works fine.
- tried to change the location of the jar because I thought it was a permission issue.
- selinux is off
How can I fix this problem to start the jar on boot? are there any alternatives? (RHEL7 does not include a service command)
source share