You are not logged in.

#1 2015-06-01 16:00:54

nbd
Member
Registered: 2014-08-04
Posts: 389

[SOLVED] Pop-up windows in systemd daemons

There is a python script running as daemon and reacting on commands. One of commands calls gpg which then shows a password propmpt popup dialog window. When the script is started from a terminal, popup window appears OK. But when the script is started by ( user ) systemd - popup doesn't appear. I tried various combinations of StdOut configuration in the systemd ini file - but haven't found the correct one. When I specify "StandardOutput=tty", script start fails with error:

Failed at step STDOUT spawning /usr/bin/python: Permission denied

The systemd service file is as follows:

[Unit]
Description=My script
[Service]
Type=simple
#StandardOutput=tty
#TTYPath=/dev/console
#TTYReset=yes
#TTYVTDisallocate=yes
#Type=forking
ExecStart=/home/user/myscript.py --start
ExecStop=/home/user/myscript.py --stop
RestartSec=2
TimeoutStartSec=2
TimeoutStopSec=2

[Install]
WantedBy=multi-user.target

What configuration should be used for displaying popup windows by service processes?

Last edited by nbd (2015-06-01 21:29:59)


bing different

Offline

#2 2015-06-01 21:17:51

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,304

Re: [SOLVED] Pop-up windows in systemd daemons

If the password prompt dialog window is graphical, you need to pass the DISPLAY environment variable to the 'systemd --user' daemon:
see https://wiki.archlinux.org/index.php/Sy … _variables

or add this line in the '[Service]' section of the service file:

Environment=DISPLAY=:0

Offline

#3 2015-06-01 21:29:28

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] Pop-up windows in systemd daemons

Thanks, berbae, it worked!


bing different

Offline

Board footer

Powered by FluxBB