On 8/13/07, Nils Bruin <[EMAIL PROTECTED]> wrote:
> Thank you for the responses. It turns out that indeed sending a sigint
> does the trick, but you have to send it to the right process. In
> hindsight it's the obvious one, but it took me some experimentation.
> For posterity:
> In order to kill a sage notebook gracefully, execute (pun not quite
> intended):
> kill -INT `cat sage_notebook/twistd.pd `
> Furthermore, having a "-daemonise" for "sage -notebook" would be
> really useful. Having a "sage -notebook -terminate" run the kill
> command above would be nice too (since it already knows how to fail to
> run due to finding the "pd" file, it should be easy to kill the
> corresponding process instead).

Good idea.

Regarding deamonizing the notebook, the way the notebook runs now
is that it sets up a twisted tac file, and runs twistd (the twisted deamon)
on it.   I.e., making it run as a normal deamon, doing proper loging, etc.,
are all probably just a matter of passing some command line options
onto the twistd command, so implementing that might be easy.

> Is it the intention that "sage -notebook ..." has the ability of
> passing options on to "notebook(...)"? (the documentation suggests so)
> In that case, could some examples be included, for instance how to
> include options to run a secure notebook, to allow account creation
> etc?

It is a bad idea to rpass options via "sage -notebook".  It's much much
better to do something like
   echo "notebook(...)" | sage

On my serious notebooks, e.g., the public servers I do this:

(1) have a file that starts the notebook by running a .py file:

[EMAIL PROTECTED]:~/nb1$ more start_notebook
cd /home/server2/nb1
sage notebook.py  > nohup.out &

(2) The actual .py file:
[EMAIL PROTECTED]:~/nb1$ more notebook.py
from sage.all import *

server_pool=['[EMAIL PROTECTED] -p 7000'%n for n in range(1,31)]

notebook(port=8103, accounts=True, address='sage.math.washington.edu',
         server_pool = server_pool, ulimit='-v 2000000')

> Finally "-daemonize" would be complemented nicely with a way of
> sending log messages to some logging agent (syslog ?) so that log
> rotation becomes a possibility.

Probably twistd supports this.  I hope somebody will look into this.

> Incidentally, is there away to control the detail of logging by sage?


> For teaching applications, not all users are "trusted", I'm afraid
> there will need to be fairly detailed tools to trace down possible
> abuse.

If you're going to use the notebook in the context of untrusted users
and teaching, you'll need to create a server pool (i.e., a list of ssh
accounts with ssh keys setup so the notebook process can ssh to them --
see the example above).  Otherwise any user can cause arbitrary harm
to the notebook server.

Regarding logging options, this came up before when discussing trying
to figure out how people use the notebook.   It would be very useful if
somebody were to list what they think should actually be logged, and
what the logging modes might be.  Right now very little is logged.


To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/

Reply via email to