Advertisement
Guest User

Init Script for VNC

a guest
Jul 1st, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4.  
  5. # Provides: tightvncserver
  6.  
  7. # Required-Start:$local_fs
  8.  
  9. # Required-Stop: $local_fs
  10.  
  11. # Default-Start: 2 3 4 5
  12.  
  13. # Default-Stop: 0 1 6
  14.  
  15. # Short-Description: Start/stop tightvncserver
  16.  
  17. ### END INIT INFO
  18.  
  19.  
  20.  
  21. # More details see:
  22.  
  23. # http://www.penguintutor.com/linux/tightvnc
  24.  
  25.  
  26.  
  27. ### Customize this entry
  28.  
  29. # Set the USER variable to the name of the user to start tightvncserver under
  30.  
  31. export USER='limpriv'
  32.  
  33. ### End customization required
  34.  
  35.  
  36.  
  37. eval cd ~$USER
  38.  
  39.  
  40.  
  41. case "$1" in
  42.  
  43. start)
  44.  
  45. sudo su $USER -c '/usr/bin/tightvncserver -localhost :1'
  46.  
  47. echo "Starting TightVNC server for $USER "
  48.  
  49. ;;
  50.  
  51. stop)
  52.  
  53. pkill Xtightvnc
  54.  
  55. echo "Tightvncserver stopped"
  56.  
  57. ;;
  58.  
  59. *)
  60.  
  61. echo "Usage: /etc/init.d/tightvncserver {start|stop}"
  62.  
  63. exit 1
  64.  
  65. ;;
  66.  
  67. esac
  68.  
  69. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement