2

I have the following service configured:

[Unit]
Description=HB service started

[Service]
Restart=always # or always, on-abort, etc
RestartSec=3
WorkingDirectory=/home/debian/hb/program
ExecStart=/home/debian/hb/program/program1

[Install]
WantedBy=multi-user.target

Then I do:

ps -ef|grep program1

to get the process id and kill it with "kill". -- just to see if it restarts just as I had it written.

Thing is, the service is NOT restarting!! No matter what I do, whenever I kill the process, the service won't restart. Any idea of what's going on?

Luis Cruz
  • 131
  • 1
  • 5
  • Do you see anything getting logged when the process dies? Do you see anything in the status (`systemctl status`)? – Zoredache Jun 27 '18 at 00:40
  • not really. Well only this: Process: 990 ExecStart=/home/debian/hb/program/program1 (code=killed, signal=TERM ) Main PID: 990 (code=killed, signal=TERM) – Luis Cruz Jun 27 '18 at 01:13
  • 1
    Did you run `systemctl daemon-reload` after making changes to this file? – Tejas Sarade Jun 27 '18 at 04:10
  • Yes I did.... Well I think I fixed it though... I just switch the order of the things, moved up Execstart and moved down Restart. – Luis Cruz Jun 27 '18 at 21:59

1 Answers1

1

So I figured it out. This solved my issue:

[Unit]
Description=HB service started

[Service]
WorkingDirectory=/home/debian/hb/program
ExecStart=/home/debian/hb/program/program1
Restart=always # or always, on-abort, etc
RestartSec=3

[Install]
WantedBy=multi-user.target

Basically I changed the order of the things, and it worked... Weird but that did the trick.

Luis Cruz
  • 131
  • 1
  • 5
  • And then people ask why I drink my bathwater when it gets to systemd... have oom-killer events that I wanted it to restart things... but it didn't, will be checking order now ;( – Hvisage Jun 05 '22 at 20:31