This isn't really a question as much as it is an attempt to get the "Sage daemon/service" keywords index in search engines (I came upon many people asking for this in my own search).
I figured out how to run Sage as a daemon using Python and sockets - the code can be found in http://ask.sagemath.org/question/23431/running-sage-from-other-languages-with-higher-performance/ .
I was looking into creating an init script, but my Linux knowledge is too lacking in this area (even when I try to edit the /etc/init.d/skeleton script). In any case anyone who can write a proper init script this would be very welcome - I was imagining something along the lines of an init script calling a binary /usr/bin/sageadmin that would:
- Start daemon via Sage executable and path to the Python daemon script
- Stop daemon using sockets
- Check status using sockets
As for the sageadmin binary I can write the socket C code, but I'm not sure what else is required. http://www.enderunix.org/docs/eng/daemon.php seems to have a couple of good points, but again - I'm not that comfortable with writing code for something this low level in Linux.
So to sum up: I've made the Python script for "daemonizing" Sage - I'm hoping someone else (with more complete Linux knowledge) can write an init script and the required parts of a sageadmin binary.