Advertisement
overloop

sage-server

Apr 1st, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.79 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. NAME=sage-server
  4. PIDFILE=/home/sage/.sage/sage_notebook.sagenb/sagenb.pid
  5.  
  6. case "$1" in
  7.     start)
  8.         if [ -f "$PIDFILE" ]; then
  9.             echo "Server $NAME is running"
  10.         else
  11.             echo "Starting $NAME"
  12.             /bin/su -c 'echo "import sagenb.notebook.notebook_object as nb; nb.notebook(interface=\"127.0.0.1\")" | /home/sage/sage-6.5/sage -python &' - sage
  13.         fi
  14.         ;;
  15.     stop)
  16.         if [ -f "$PIDFILE" ]; then
  17.             kill `cat $PIDFILE`
  18.         else
  19.             echo "Server $NAME is not running"     
  20.         fi
  21.         ;;
  22.     restart)
  23.         echo "Restarting daemon: " $NAME
  24.         if [ -f "$PIDFILE" ]; then
  25.             kill `cat $PIDFILE`
  26.             sleep 10
  27.         fi
  28.         echo "Starting $NAME"
  29.         /bin/su -c 'echo "import sagenb.notebook.notebook_object as nb; nb.notebook(interface=\"127.0.0.1\")" | /home/sage/sage-6.5/sage -python &' - sage
  30.         ;;
  31. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement