2

I have a go project and when I compile it I get your typical binary. If I call the binary directly from the command line with the adequate inputs, it runs perfectly well. I want to make this program part of the systemd ecosystem though and the following is my binary.service

[Unit]
Description=Run Go Service

[Service]
WorkingDirectory=/path/to/directory/
ExecStart=/path/to/directory/binary --config /full/path/to/service.conf
Restart=always

[Install]
WantedBy=multi-user.target

I can start and stop the service using the usual call sudo service application start. I don't receive any error messages but when I check journalctl -xe it says the start failed but it gives no details as to why. If I run the exact same command through the command line and not through systemd, the application runs just fine. How do I troubleshoot this?

Mnemosyne
  • 151
  • 4
    service command is initd component. Try start service as systemctl start application and systemctl status application after it. – Yurij Goncharuk Mar 25 '18 at 20:15
  • It gives out no error messages. But this program should have a server running and I can not connect to that ip:port so for all intents and purposes the service is still unreachable. – Mnemosyne Mar 25 '18 at 20:23
  • 1
    I'm by far no systemd expert, but I read a few articles recently, and it might be that you have tell systemd what kind of behaviour to expect from your application by using the Type= parameter in the unit file. – Multisync Mar 25 '18 at 20:24
  • I have tried that to. My current version of the file has Type=simple (which is also the default if you don't add a type) but it doesn't make a difference. – Mnemosyne Mar 25 '18 at 20:36
  • It's no need to set Type=. By default it has simple value and starts service from ExecStart field value. "No need" - I mean case from question. – Yurij Goncharuk Mar 25 '18 at 20:36
  • Is your application an ordinary application or daemon? Service file looks like good, but no more info about your application. – Yurij Goncharuk Mar 25 '18 at 20:39
  • It is basically a go binary that runs a server. So an ordinary application I'd say. – Mnemosyne Mar 25 '18 at 21:59
  • 2
    Both journalctl and systemctl status in fact do give details of what is going on, and this information needs to be [edit]ed into your question. – JdeBP Mar 25 '18 at 22:46
  • Please ready the the answer to the FAQ Why do things behave differently under systemd? and see if one of those cases applies. – Mark Stosberg Mar 26 '18 at 14:44

0 Answers0