Ticket #381 (new enhancement)

Opened 5 years ago

Last modified 19 months ago

SAGE daemon mode

Reported by: was Owned by: mabshoff
Priority: minor Milestone: sage-5.0
Component: user interface Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

On May 28, 5:11 pm, Marshall Hampton <hampto...@gmail.com> wrote:
> This is more of a unixy process control question but I am applying it
> to sage.
>
> I would like to start a notebook on my office machine while I am at a
> conference.  I tried logging in with ssh, starting the notebook,
> suspending it with ctrl-z, and then putting the suspended process in
> the background with bg.  This didn't really work, although I could
> still restart the notebook server with a browser.  I could figure this
> out eventually but I am hoping someone reading this list already knows
> how to do this.

There are several options:

1) use screen - see www.gnu.org/software/screen/
2) use nohup - see man nohup
3) use disown - see http://www.faqs.org/docs/bashman/bashref_79.html

All have their specific advantages, I would just go with screen.

It might be worthwhile to offer an option for SAGE to demonize itself.

Cheers,
Michael Abshoff

Change History

comment:1 Changed 5 years ago by was


Well, the idea is to detach the running SAGE instance from the shell
to let it run in the background until it is killed or the system is
rebooted.

There is more than one way to do it: For a good C example see
http://www.enderunix.org/docs/eng/daemon.php - for a python example
see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012

The python example could be more or less copied (I guess because I am
not a python expert), but it should be done very early in the SAGE
startup as far as I can tell. Writing a little C wrapper that just
does

 i=fork();
 if (i<0) exit(1); /* fork error */
 if (i>0) exit(0); /* parent exits */
 /* child (daemon) continues */
 execv("./sage");

might be easier.

comment:2 Changed 5 years ago by mabshoff

  • Owner changed from was to mabshoff
  • Status changed from new to assigned
  • Milestone set to sage-2.8.2

comment:3 Changed 5 years ago by mabshoff

  • Milestone changed from sage-2.8.2 to sage-2.9

comment:4 Changed 19 months ago by klee

  • Report Upstream set to N/A

Look at http://trac.sagemath.org/sage_trac/ticket/7893

It would be good to incorporate the idea of the example to the script in the previous ticket.

Note: See TracTickets for help on using tickets.