Score:0

How to open a link in a browser using a program started from a systemd service?

in flag

I am trying to write a program that would open a particular link every hour or so. I have written the program using C and it works using the command line. But when I try to run it as a systemd service I get the error:

sgma[9997]: [9997:9997:1007/143623.911474:ERROR:browser_main_loop.cc(1402)] Unable to open X display.

This is my unit file:

[Unit]
Description=Simple G Meet Autojoiner

[Service]
Type=simple
ExecStart=/usr/local/bin/sgma

[Install]
WantedBy=multi-user.target
raj avatar
cn flag
raj
Obviously something that is starting from systemd does not have an X display. I guess it would be better to start your service not from systemd, but from GNOME session autostart programs.
walidathome avatar
in flag
oh okay thanks I thought programs started using systemd was just like running a program on the terminal.
raj avatar
cn flag
raj
Yes, on a **text** terminal. Not on a terminal being a part of a graphics DE.
vanadium avatar
cn flag
It would work for a terminal program. Your program, however, requires a graphical display.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.