Advertisement
Guest User

Untitled

a guest
May 30th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. # JupyterHub start / stop / restart script
  2. #
  3. # description: JupyterHub start / stop / restart script
  4. # chkconfig: 2345 20 80
  5. # processname: jupyterhub
  6. # pidfile: /var/run/jupyterhub.pid
  7.  
  8. JUPYTERHUB_HOME=/usr/local/bin
  9. JUPYTERHUB_CONFIG=/etc/ipython/jupyterhub_config.py
  10. JUPYTERHUB_LOG=/var/log/jupyterhub.log
  11. USER=root
  12.  
  13. case $1 in
  14. start)
  15. if [ ! -e /var/run/jupyterhub.pid ] || [ "$(cat /var/run/jupyterhub.pid)" == "" ]
  16. then
  17. echo "Starting JupyterHub"
  18. su - $USER -c "${JUPYTERHUB_HOME}/jupyterhub -f ${JUPYTERHUB_CONFIG} &>> ${JUPYTERHUB_LOG} &"
  19. else
  20. echo "JupyterHub is already running"
  21. fi
  22. ;;
  23. stop)
  24. if [ -e /var/run/jupyterhub.pid ] && [ "$(cat /var/run/jupyterhub.pid)" != "" ]
  25. then
  26. echo "Stopping JupyterHub"
  27. su - $USER -c "kill $(cat /var/run/jupyterhub.pid)"
  28. sleep 3
  29. else
  30. echo "JupyterHub is not running"
  31. fi
  32. ;;
  33. restart)
  34. if [ -e /var/run/jupyterhub.pid ] && [ "$(cat /var/run/jupyterhub.pid)" != "" ]
  35. then
  36. echo "Stopping JupyterHub"
  37. su - $USER -c "kill $(cat /var/run/jupyterhub.pid)"
  38. sleep 3
  39. fi
  40. echo "Starting JupyterHub"
  41. su - $USER -c "${JUPYTERHUB_HOME}/jupyterhub -f ${JUPYTERHUB_CONFIG} &>> ${JUPYTERHUB_LOG} &"
  42. ;;
  43. *)
  44. echo "Usage: `basename $0` start|stop|restart"
  45. exit 1
  46. ;;
  47. esac
  48. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement