lad1337 / XDM

XDM: eXtendable Download Manager. Plugin based media collection manager.
xdm.lad1337.de
Other
203 stars 46 forks source link

Init script for systemd #118

Closed pmoranga closed 10 years ago

pmoranga commented 10 years ago

Init script systems managed with systemd

lad1337 commented 10 years ago

honestly no idea if the process is killed "gracefully" if the PID is killed i test that later

lad1337 commented 10 years ago

okay i tested a simple "kill PID" and i get a "Terminated: 15" and no shutdown process of XDM which is only a problem if a long running task us running like copying/moving a file and the process would be killed too then again this might not be an issue ... but i will try more kill options to send do a "graceful" shutdown

although this might not work with the current version since the only thing that shuts down gracefully is a "ctrl + c" or thru the web interface but it should be simple to add it

edit: this looks promising http://docs.python.org/2/library/signal.html

pmoranga commented 10 years ago

Hi, This fixed the issue of not handling signals. I trapped SIGTERM to shutdown procedure, and SIGHUP to the reload.

Please let me know if the code should be somewhere else.

I tested on a Linux platform and it worked as expected, if you could have someone testing on Windows would be nice.

lad1337 commented 10 years ago

looks good ... i can't test on windows ^^ my vm is broken/dead and i am running / working on OSX :/