I have the upstart script below, how can I translate it into a systemd service ?

description "x11vnc"

start on runlevel [2345]
stop on runlevel [^2345]

#console log

respawn limit 20 5

exec /usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /root/.vnc/passwd -rfbport 5900 -shared

1 Answer 1


Some of the configuration options of an upstart configuration can be translated directly into systemd unit directives. That's the case for description (which becomes Description=) and exec (which becomes ExecStart=.)

The upstart configuration doesn't have an expect fork or daemon stanza (which would translate into Type=forking), so we should use Type=simple for our systemd unit.

Let's take a look at the remaining stanzas:

start on runlevel [2345]
stop on runlevel [^2345]

This is essentially just saying this service should start when the machine boots and stop when it shuts down. In systemd, this is done by installing it and linking it to multi-user.target. See the [Install] section on the final unit.

#console log

This is commented out... But you could control similar configuration from a systemd unit using StandardOutput= and related options.

In upstart, console logged is the default and it somewhat matches the systemd default of sending output to the journal (since the journal is the main logger in systemd world.)

respawn limit 20 5

So the first line asks that the service should be restarted if it ends unexpectedly, which I believe would translate to Restart=on-failure, though it is possible that Restart=yes (always restart) is closer to what upstart does here (I don't know enough upstart to tell exactly which it does.)

The second line indicates the limits, respawn at most 20 times in 5 seconds, which in systemd you would configure with StartLimitBurst=20 and StartLimitIntervalSec=5.

Finally, putting it all together, you get this in your /etc/systemd/system/x11vnc.service file:


ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /root/.vnc/passwd -rfbport 5900 -shared


After creating this file, execute systemctl daemon-reload for systemd to load the unit file. Then systemctl start x11vnc.service for it to start running it and systemctl enable x11vnc.service for it to start it on boot.

  • Thank you very much for the solution and the very useful explanation.
    – famedoro
    Feb 24, 2019 at 17:00
  • 1
    Happy to help! If it doesn't work for you, post more comments, I'm happy to try to fix anything if anything is not working as expected. Thanks!
    – filbranden
    Feb 24, 2019 at 17:16

You must log in to answer this question.

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