BASH   104
ubuntu startup script
Guest on 4th February 2023 02:01:29 AM


  1. #!/bin/bash
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides:          vncserver
  5. # Default-Start:     5
  6. # Default-Stop:
  7.  
  8. PATH=$PATH:/usr/bin
  9. export USER=wrf
  10. DISPLAY=1
  11. DEPTH=24
  12. GEOMETRY=1152x768
  13. OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
  14. #. /lib/lsb/init-functions
  15.  
  16.  
  17. case "$1" in
  18.    start)
  19.        echo "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
  20.        su ${USER} -c "vncserver ${OPTIONS}"
  21.    ;;
  22.  
  23.    stop)
  24.       echo "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
  25.       su ${USER} -c "vncserver -kill :${DISPLAY}"
  26.    ;;
  27.  
  28.    restart)
  29.       $0 stop
  30.       $0 start
  31.    ;;
  32. esac
  33. exit 0
  34.  
  35. # To add it to autostart, run update-rc.d vncserver defaults

Raw Paste

Login or Register to edit or fork this paste. It's free.