4

Here is my boondocks-agent.service file. I have installed it in /lib/systemd/system:

[Unit]
Description=Boondocks agent
Requires=\
    balena.service 
After=\
    balena.service 

[Service]
Type=simple
Restart=always
RestartSec=10s
WatchdogSec=60
EnvironmentFile=/etc/boondocks-agent/agent.conf
EnvironmentFile=-/tmp/boondocks-agent.conf
ExecStartPre=-/usr/bin/stop-boondocks-agent
ExecStart=/usr/bin/healthdog --healthcheck=/usr/lib/boondocks-agent/boondocks-agent-healthcheck  /usr/bin/start-boondocks-agent
ExecStop=-/usr/bin/stop-boondocks-agent

[Install]
WantedBy=multi-user.target

It doesn't appear to start up when I boot the system. After a clean boot, this is what I see for status:

systemctl status boondocks-agent
boondocks-agent.service - Boondocks agent
   Loaded: loaded (/lib/systemd/system/boondocks-agent.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

What do I have to do to make this start up automatically on boot?

Edit

In YOCTO, the equivalent to calling systemctl enable is:

SYSTEMD_SERVICE_${PN} = " \
    boondocks-agent.service
    "
6
  • @UlrichSchwarz - apologies - the actual service file has the absolute path. The original question has the template I use to generate the file in a YOCTO build. I'll edit.
    – RQDQ
    May 4, 2018 at 12:54
  • If this is a user-supplied unit, you really want to put it in /etc/systemd/system: the /lib/systemd/system directory is for the distribution's use. Although installers are good about not messing with foreign files, it's a risk that you don't have to take! Also, your /etc/systemd/ files will override anything in /lib/systemd/, preventing potential issues in the future.
    – ErikF
    May 4, 2018 at 17:55
  • @ErikF - I think in this case, because I'm building the distribution using YOCTO, I am the distribution.
    – RQDQ
    May 4, 2018 at 18:24
  • Sorry, I forgot about that. I've gotten lazy and let my distros do all the grunt work for me! :-) I should really give it a shot; YOCTO looks really interesting.
    – ErikF
    May 4, 2018 at 18:51
  • @ErikF - YOCTO is great - once you get past the really really steep learning curve. :-)
    – RQDQ
    May 4, 2018 at 19:34

2 Answers 2

6

You say,

In YOCTO, the equivalent to calling systemctl enable is:

   SYSTEMD_SERVICE_${PN} = " \
       boondocks-agent.service
       "

I think this is the equivalent to installing the service.  To have the service default to enabled you would want to add:

SYSTEMD_AUTO_ENABLE_${PN} = "enable"
1
4

You need to enable it a boot time:

systemctl enable boondocks-agent

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.