Last active
July 28, 2021 17:06
-
-
Save imasimali/f0616472e65b1817da0f13c4dcda742b to your computer and use it in GitHub Desktop.
Use this code to set up the VNC server as a systemd service. This will make it possible to start, stop, and restart it as needed, like any other systemd service.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo nano /etc/systemd/system/vncserver@.service | |
PASTE this code (dont forget to change the username): | |
""" | |
[Unit] | |
Description=Start TightVNC server at startup | |
After=syslog.target network.target | |
[Service] | |
Type=forking | |
User=<user name> | |
WorkingDirectory=/home/<user name> | |
PIDFile=/home/<user name>/.vnc/%H:%i.pid | |
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i | |
ExecStop=/usr/bin/vncserver -kill :%i | |
[Install] | |
WantedBy=multi-user.target | |
""" | |
sudo systemctl daemon-reload | |
sudo systemctl enable vncserver@1.service | |
sudo systemctl start vncserver@1 | |
sudo systemctl status vncserver@1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment