Skip to content

Instantly share code, notes, and snippets.

@mateuszwojt
Created January 20, 2019 06:21
Show Gist options
  • Save mateuszwojt/7e189b9d3f6b362892e2910e271c9bc1 to your computer and use it in GitHub Desktop.
Save mateuszwojt/7e189b9d3f6b362892e2910e271c9bc1 to your computer and use it in GitHub Desktop.
Init.d system service for launching tightvncserver
#!/bin/sh -
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts VNC
# Description:
### END INIT INFO
. /lib/lsb/init-functions
# Check the state of the command - this'll either be start or stop
case "$1" in
start)
# if it's start, then start vncserver using the details below
su root -c "/usr/bin/vncserver :1 -localhost no -geometry 1280x800 -depth 16 -pixelformat rgb565"
;;
stop)
# if it's stop, then just kill the process
pkill Xtightvnc
echo "vncserver stopped"
;;
*)
echo "Usage: /etc/init.d/vncserver {start|stop}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment