Home > Enterprise >  Linux service "Failed with result 'start-limit-hit'." error while trying to run
Linux service "Failed with result 'start-limit-hit'." error while trying to run

Time:09-13

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

CodePudding user response:

I solved it.

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

  • Related