Quantcast
Channel: FedoraForum.org
Viewing all articles
Browse latest Browse all 36122

Start service after desktop loads

$
0
0
I try to find a smart solution to start a systemd service (pluto.service) after desktop loads.

The service launch a GUI application (myprogram) as user pippo.

For my interest, is necessary to restart the application every time
it goes down (for example: SEGFAULT).

My current solution delays the service for a custom time:

Code:

[Unit]
Description=PLUTO service manager
After=local-fs.target remote-fs.target
# network.service ntpd.service

[Service]
User=pippo
Group=pippo
Environment= DISPLAY=:0 HOME=/home/pippo
#ControlGroup=cpu:/
#CPUSchedulingPolicy=fifo
#CPUSchedulingPriority=99
Type=simple
ExecStartPre=/bin/sleep 10
ExecStart=/home/pippo/bin/myprogram
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

In this solution there are two problems:

1) If something go wrong at startup, the service could start before desktop loads and if it happen, the application GUI is not visible, but the service is still running (verified with systemctl status pluto.service)

2) Every time the service restart, it wastes time because of the presence of RestartSec and ExecStartPre parameters.. I desire to remove at least one of these pauses

Thanks

Viewing all articles
Browse latest Browse all 36122

Trending Articles