Score:0

Run Mono Application on Startup with a Service

gr flag

When the ubuntu system boots up, my service that starts test.exe fails (using systemctl status Testprog.service):

at System.Windows.Forms.XplatUIX11..ctor ()
at System.Windows.Forms.XplatUIX11.GetInstance ()
at System.Windows.Forms.XplatUI..cctor ()
--- End of inner exception stack trace ---
at System.Windows.Forms.Application.EnableVisualStyles ()
at Testprog.Program.Main (System.String[] args)

The Testprog.service located at /lib/systemd/system/Testprog.service:

[Unit]
Description=test launcher
Requires=display-manager.service
After=display-manager.service network.target syslog.target

[Service]
Type=forking
Environment="DISPLAY=:0" "XAUTHORITY=/run/user/1000/gdm/Xauthority"
ExecStart=/bin/bash -c "export DISPLAY=:0; mono test.exe"

[Install]
WantedBy=multi-user.target

When I start the service manually (using systemctl restart Testprog.service) the program starts without errors but the test.exe does not start when the systems boots.

I don't see what is wrong. Any help is appreciated.

I sit in a Tesla and translated this thread with Ai:

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.