skip to Main Content

I have some scripts to restart a java jar service in linux machine taken from this post

and here is my service script:

[Unit]
Description=demo restarter
After=network.target

[Service]
Type=oneshot
ExecStart=systemctl stop demo.service
StartLimitIntervalSec=0
StartLimitBurst=0
ExecStartPost=systemctl start demo.service

[Install]
WantedBy=multi-user.target

If I manually add or remove file from the directory it works fine. But my main purpose is deploying jar file from bitbucket to droplet linux vm and if the file(jar) comes from bitbucket then I get the error:

Sep 08 00:09:06 ubuntu-1cpu systemd[1]: Failed to start DEMOOOOOO Spring Boot application service.
Sep 08 00:09:06 ubuntu-1cpu systemd[1]: demo.service: Start request repeated too quickly.
Sep 08 00:09:06 ubuntu-1cpu systemd[1]: demo.service: Failed with result 'start-limit-hit'.
Sep 08 00:09:06 ubuntu-1cpu systemd[1]: Failed to start DEMOOOOOO Spring Boot application service.
Sep 08 00:09:06 ubuntu-1cpu systemd[1]: demo.service: Start request repeated too quickly.
Sep 08 00:09:06 ubuntu-1cpu systemd[1]: demo.service: Failed with result 'start-limit-hit'.
Sep 08 00:09:06 ubuntu-1cpu systemd[1]: Failed to start DEMOOOOOO Spring Boot application service.

I did

StartLimitIntervalSec=0
StartLimitBurst=0

as suggested in some posts but still I am getting demo.service: Failed with result ‘start-limit-hit’. error.

How can I solve this problem ? (I am suspicious about that when I deploy the jar from bitbucket it is overriding the original jar and maybe it makes problem??)

And here is the service file:

[Unit]
Description=DEMOOOOOO Spring Boot application service
After=network.target

[Service]
#User=ubuntu
Type=simple
ExecStart=java -jar /root/artifacts2/demo-0.0.1-SNAPSHOT.jar

TimeoutStopSec=10
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

here path file:

[Path]
Unit=demo-watcher.service
PathModified=/root/artifacts2

[Install]
WantedBy=multi-user.target

2

Answers


  1. Chosen as BEST ANSWER

    I solved it.

    I have changed PathModified= to PathChanged= in path script and the problem is solved.


  2. sometimes this message can be misleading, if above fix doesnt work, try changing "User" and also try upgrading or downgrading java version. This can be due to a java version mismatch too..

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search