0

I have a cpp application which broadcasts an object and its methods on the dbus. I try to run this program at startup with the following service file:

[Unit]
Description=Running dbus program
After=network.target

[Service]
Type=simple
ExecStart=/home/my_name/Documents/dbus/build/my_app
StandardOutput=console+journal
StandardError=console+journal

[Install]
WantedBy=multi-user.target

After reloading:

systemctl daemon-reload

and running it:

sudo systemctl start my_service.service

I got no error in the journal, but I cant see anything on the dbus (running d-feet, and browsing for my object, I cant find anything)

Running the exact same ExecStart:

/home/my_name/Documents/dbus/build/my_app

in the console works fine.

What am I missing? Thanks!

DiXcipuli
  • 359
  • 3
  • 11
  • What do you get reported if you type `service my_service status`? – ukBaz Jan 03 '22 at 11:14
  • @ukBaz I get that my service is loaded and active(running), and I get the correct printed output I am supposed to get. But still cant see anything. – DiXcipuli Jan 03 '22 at 11:26
  • Would I be correct in assuming you are publishing your service on to the session bus? Links to a couple of solutions about how to get your service on the correct session bus: https://serverfault.com/a/906224 and https://unix.stackexchange.com/a/83409 – ukBaz Jan 03 '22 at 11:43
  • @ukBaz Thanks for your lead. Indeed I am running it on the session bus. Well what you shared brings a new level of complexity to my comprehension, I ll need some time to assimilate it! – DiXcipuli Jan 03 '22 at 13:59
  • I knew I had answered about `systemd` and `session bus` before... https://stackoverflow.com/a/69432686/7721752 – ukBaz Jan 03 '22 at 15:38

1 Answers1

0

As you want your service to run on the session bus you will need to use:

sudo systemctl --user start my_service.service

Putting the file into /etc/systemd/user/ location will make it available to all users still.

ukBaz
  • 6,985
  • 2
  • 8
  • 31