Hi all, while looking at the SAGE FAQ here [1], I noticed the link to Trac #381 [2] (the link is broken, on the FAQ page, though).
One option which is not mentioned, but which is extremely convenient, is to run Sage using a systemd user session. The Arch Linux packages for Sage include the file /usr/lib/systemd/user/sage.service which is just [Unit] Description=A free open-source mathematics software system [Service] ExecStart=/opt/sage/sage -n [Install] WantedBy=default.target Now when I want to run a Sage notebook as a daemon, I can run $ systemctl --user start sage and get its status with $ systemctl --user status sage sage.service - A free open-source mathematics software system Loaded: loaded (/usr/lib/systemd/user/sage.service; disabled) Active: active (running) since Sun 2014-02-16 00:14:11 EST; 9s ago Main PID: 19292 (bash) CGroup: /user.slice/user-1000.slice/user@1000.service/sage.service ├─19292 bash /opt/sage/sage -n ├─19301 python /opt/sage/src/bin/sage-notebook └─19353 python /opt/sage/local/bin/twistd --pidfile=sage_notebook.sagenb/sagenb.pid -ny sage_notebook.sagenb/twistedconf.tac Feb 16 00:14:11 noether systemd[537]: Starting A free open-source mathematics software system... Feb 16 00:14:11 noether systemd[537]: Started A free open-source mathematics software system. Or I can run $ systemctl --user enable sage.service to launch the Sage server automatically every time I log in -- and this is all done as my user, not as root. There’s a bunch of nice stuff that comes for free this way. For instance, if I want to prevent Sage from eating my RAM, I just create (as root) /etc/systemd/user/sage.service with, say .include /usr/lib/systemd/user/sage.service [Service] MemoryLimit=1G and then the process control group Sage runs in is limited to 1G memory across all of its child processes. You can also do all kinds of other resource management this way -- CPU priority, CPU affinity, swappiness, IO scheduler, etc. This approach requires systemd and is Linux-specific, but as every major Linux distribution is either using systemd now or plans to move to it in the future, it seems like it might be worthwhile for Sage to ship systemd .service files for Linux users. Cheers, Henry de Valence [1]: http://www.sagemath.org/doc/faq/faq-usage.html#how-do-i-run-sage-in-daemon-mode-i-e-as-a-service [2]: http://trac.sagemath.org/ticket/381 -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.