Adding a systemd .service (Debian)

conkysystemd

I'm following this tutorial (Creating my own systemd service files on Fedora 16(x86_64)) to add a new systemd .service, but it doesn't work, I did step by step correct with some modifications to my scope.

My conkystart.service:

[Unit]
Description=Service to start conky at boot
After=graphical.target multi-user.target

[Service]
Type=simple
ExecStart=/usr/local/bin/conkystart.service

[Install]
WantedBy=multi-user.target

My simple script:

!#/bin/bash

sleep && conky;

Nothing it does'nt work. Some advice guys? What's wrong here?

Best Answer

You can't use this approach for conky. These scripts are run before the GUI is loaded and before you log in. Your service is loaded and attempts to execute conky, which promptly exits because there are no available X screens.

This sort of thing should be done via the autorun settings of whatever desktop environment or window manager you are using. Many common desktop environments will run the program described by any .desktop files in ~/.config/autostart. For example, to run conky create a file called ~/.config/autostart/conky.desktop with the following contents:

[Desktop Entry]
Type=Application
Exec=/usr/bin/conky
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name[en_US]=conky
Comment[en_US]=
X-GNOME-Autostart-Delay=0
Related Question