FS#32908 - [sage-mathematics] add sage.service to start notebook
Attached to Project:
Community Packages
Opened by Andrzej Giniewicz (Giniu) - Thursday, 29 November 2012, 22:37 GMT
Last edited by Daniel Wallace (gtmanfred) - Friday, 24 May 2013, 14:34 GMT
Opened by Andrzej Giniewicz (Giniu) - Thursday, 29 November 2012, 22:37 GMT
Last edited by Daniel Wallace (gtmanfred) - Friday, 24 May 2013, 14:34 GMT
|
Details
When we had initscripts it was hard to do. Now, with systemd
it's very easy to start notebook at system start and close
it cleanly. I don't have service file which would work for
package, I have one that works for development environment
(I have sage:users who compiles different versions and I
switch symlinks around, that's why I have notebook started
that way). Anyway, this already contains clean way to shut
down notebook (KillSignal and SendSIGKILL, it sends single
ctrl-c for closing) and works remarkably compared to any
initscript solution I've seen. That one might be used as
starting point.
[Unit] Description=Sage: Open Source Mathematics Software [Service] ExecStart=/usr/local/bin/sage -notebook Restart=on-failure User=sage Group=users KillSignal=SIGINT SendSIGKILL=no [Install] WantedBy=multi-user.target |
This task depends upon
Closed by Daniel Wallace (gtmanfred)
Friday, 24 May 2013, 14:34 GMT
Reason for closing: Implemented
Additional comments about closing: included a systemd --user unit
Friday, 24 May 2013, 14:34 GMT
Reason for closing: Implemented
Additional comments about closing: included a systemd --user unit
1) create directory /srv/sage and set owner to sagemath:sagemath
2) change the $HOME of sagemath user to /srv/sage (I think /srv/sage is more suitable for putting the service files than the default $HOME /opt/sage)
3) create systemd service
[Unit]
Description=A free open-source mathematics software system
[Service]
User=sagemath
Group=sagemath
ExecStart=/bin/sh -c 'cd $HOME && /opt/sage/sage -n interface="localhost" automatic_login=False'
ExecStop=/bin/kill $MAINPID
[Install]
WantedBy=multi-user.target
Since my sage notebook can be accessed from Internet (through lighttpd proxy), the automatic login is disabled. While for a default installation, this may not suitable.
you can change it from that