Advertisement
mmornati

Untitled

Oct 27th, 2011
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # novnc Script to start and stop the novnc html5 "proxy" to share your vnc connection
  4. #
  5. # chkconfig: 345 65 35
  6. # description:
  7. # processname: wsproxy.py
  8. # config: /etc/sysconfig/novnc
  9.  
  10. # Source function library.
  11. . /etc/rc.d/init.d/functions
  12.  
  13. . /etc/sysconfig/novnc
  14.  
  15. exec="/var/hda/web-apps/vnc/html/utils/wsproxy.py"
  16. prog=$(basename $exec)
  17. lockfile=/var/lock/subsys/$prog
  18.  
  19. start() {
  20. if [ -f $lockfile ]; then
  21. return 0
  22. fi
  23. echo -n $"Starting $prog: "
  24. ${exec} --web $WEB ${CERT:+--cert $CERT} $PORT $VNC_DEST > /dev/null 2> /dev/null &
  25. retval=$?
  26. echo
  27. [ $retval -eq 0 ] && touch $lockfile
  28. return $retval
  29. }
  30.  
  31. stop() {
  32. echo -n $"Stopping $prog: "
  33. processpid=$(ps -ef | grep python | grep wsproxy.py | awk '{ print $2 }')
  34. kill -9 ${processpid}
  35. retval=$?
  36. echo
  37. [ $retval -eq 0 ] && rm -f $lockfile
  38. return $retval
  39. }
  40.  
  41.  
  42. restart() {
  43. stop
  44. start
  45. }
  46.  
  47. reload() {
  48. restart
  49. }
  50.  
  51. force_reload() {
  52. restart
  53. }
  54.  
  55. fdrstatus() {
  56. status $prog
  57. }
  58.  
  59. # See how we were called.
  60. case "$1" in
  61. start|stop|restart|reload)
  62. $1
  63. ;;
  64. force-reload)
  65. force_reload
  66. ;;
  67. status)
  68. fdrstatus
  69. ;;
  70. condrestart)
  71. [ ! -f $lockfile ] || restart
  72. ;;
  73. *)
  74. echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
  75. exit 2
  76. esac
  77.  
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement