Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # JupyterHub start / stop / restart script
- #
- # description: JupyterHub start / stop / restart script
- # chkconfig: 2345 20 80
- # processname: jupyterhub
- # pidfile: /var/run/jupyterhub.pid
- JUPYTERHUB_HOME=/usr/local/bin
- JUPYTERHUB_CONFIG=/etc/ipython/jupyterhub_config.py
- JUPYTERHUB_LOG=/var/log/jupyterhub.log
- USER=root
- case $1 in
- start)
- if [ ! -e /var/run/jupyterhub.pid ] || [ "$(cat /var/run/jupyterhub.pid)" == "" ]
- then
- echo "Starting JupyterHub"
- su - $USER -c "${JUPYTERHUB_HOME}/jupyterhub -f ${JUPYTERHUB_CONFIG} &>> ${JUPYTERHUB_LOG} &"
- else
- echo "JupyterHub is already running"
- fi
- ;;
- stop)
- if [ -e /var/run/jupyterhub.pid ] && [ "$(cat /var/run/jupyterhub.pid)" != "" ]
- then
- echo "Stopping JupyterHub"
- su - $USER -c "kill $(cat /var/run/jupyterhub.pid)"
- sleep 3
- else
- echo "JupyterHub is not running"
- fi
- ;;
- restart)
- if [ -e /var/run/jupyterhub.pid ] && [ "$(cat /var/run/jupyterhub.pid)" != "" ]
- then
- echo "Stopping JupyterHub"
- su - $USER -c "kill $(cat /var/run/jupyterhub.pid)"
- sleep 3
- fi
- echo "Starting JupyterHub"
- su - $USER -c "${JUPYTERHUB_HOME}/jupyterhub -f ${JUPYTERHUB_CONFIG} &>> ${JUPYTERHUB_LOG} &"
- ;;
- *)
- echo "Usage: `basename $0` start|stop|restart"
- exit 1
- ;;
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement