在Ubuntu 16.04上自動啟用Vncserver service

cd /etc/systemd/system
vim vncserver@.service

Paste below

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=edward
PIDFile=/home/edward/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280×800 :%i
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl start vncserver@1.service

systemctl enable vncserver@1.service
systemctl status vncserver@1.service

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *