0

I want to add my service (simple C++ app) to Linux image. I know how to add service in console while Linux is running (with help of systemctl) but I need to make Linux image with already added service, so when Linux starts my service have been already run, how can i do it? I make Linux image in buildroot, if its important.

AlexB
  • 81
  • 1
  • 4
  • 1
    Create the `.service` file and add symlinks from an appropriate directory, e.g. `/etc/systemd/system/multi-user.target.wants/my.service` – mkayaalp Nov 09 '21 at 03:41
  • Yep its work,. Add service to /usr/lib/systemd/system and make symlink in /etc/systemd/system/multi-user.target.wants – AlexB Nov 09 '21 at 06:06

1 Answers1

0

For a package foo, you can set FOO_INSTALL_INIT_SYSTEMD. If the service file contains the appropriate WantedBy stanza, it will be enabled automatically.

Arnout
  • 2,927
  • 16
  • 24