#7893: Sage server launching script
------------------------------------+---------------------------------------
Reporter: klee | Owner: klee
Type: task | Status: new
Priority: trivial | Milestone:
Component: experimental package | Keywords:
Author: Kwankyu Lee | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------------+---------------------------------------
Comment(by klee):
I revised the script according Donald Alan Morrison's comments:
1) The stop_server function does not do error checking to ensure that
[[BR]] the pid contained in the pid file actually corresponds to a server
[[BR]] process:
[http://www.google.com/url?sa=D&q=http://trac.sagemath.org/sage_trac/attachment/ticket/7893
/sage-server&usg=AFQjCNFolyoFiY1P1jjri5DIL9m7ZUsTrg
http://trac.sagemath.org/sage_trac/attachment/ticket/7893/sage-server]
[[BR]]
30 def stop_server(): [[BR]] 31 try: [[BR]] 32
# if sage notebook server is running, "twist.pid" is [[BR]] created
[[BR]] 33 file = open(os.environ!['HOME'] + '/.sage/ [[BR]]
sage_notebook.sagenb/twistd.pid', 'r') [[BR]] 34 pid =
file.readline() [[BR]] 35 file.close() [[BR]] 36
print "Stopping sage server..." [[BR]] 37 os.system('kill
-INT ' + pid) [[BR]] 38 except IOError: [[BR]] 39
print "No sage server running." [[BR]]
Given the frequency of reboots for most users, and the cost to the [[BR]]
user of killing a random process, it would be good to error check [[BR]]
against the actual running process name. [[BR]]
2) It would be good to add some code that waits for SIG_TERM to [[BR]]
complete, then optionally sends SIG_KILL. One can't assume SIG_TERM
[[BR]] will be handled correctly by the server, especially if it's in a
bad [[BR]] state. [[BR]]
3) The script should verify the completion of !#2, then delete the pid
[[BR]] files. [[BR]]
-Don
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7893#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.