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:

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



My simple script:


sleep && conky;

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

  • You should use code blocks (you can use the <pre> tag, or indent four spaces) so your snippets are more readable. Sep 10, 2015 at 21:19
  • 1
    your simple script doesn't work. !#/bin/bash is the invalid shebang. should be #!/bin/bash. sleep && conky; fails with sleep: missing operand Try 'sleep --help' for more information.. Why do you use sleep?
    – Evgeny
    Sep 11, 2015 at 15:30
  • @EvgenyVereshchagin the "!#/bin/bash" was a simple write error, in my script is correct "#!/bin/bash". And i'm using sleep because the script i'm using to initialize in mate-session-properties is it. I'm newbie in shell script. Sep 11, 2015 at 19:48

2 Answers 2


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]

conky is an application that you probably want your user to launch (since it appears on your desktop). Launching it with systemd makes is a system process; systemd doesn't know where to put conky, or who to run it as.

What desktop environment are you using? there is usually an autostart function in a desktop's configuration, in which you can start user-processes once logged in.

  • I use mate in debian 8, and it works alright with a startup script in matesessionproperties, i'll like to put it in systemd to study how systemd works and to practice with a exercise. It Isn't possible? Sep 11, 2015 at 1:42
  • I think it might be a better idea to just make a script that logs something to a file. For instance, rather than launching a graphical application like conky, try just echo "$USER $(date)" > /tmp/sysd-test.log or whatever. This way, you get to see that your systemd script worked, but you don't run into the nuances of which user is doing what. Sep 11, 2015 at 1:49
  • 1
    conky needs to run inside an X display, and systemd services don't have any of the environment variables set to allow conky to find the X display. ($DISPLAY and $XAUTHORITY, for example) While technically possible to script around this by dynamically finding existing X sessions, it's probably not a great place to start for learning how to write systemd service units.
    – jsbillings
    Sep 12, 2015 at 13:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .