Custom Services start-stop question

view full story

http://www.linuxquestions.org – Here is what I would like to do: 1) Have a service I've written start up at login 2) The service will run continuously until logout 3) At logout the service will perform some shutdown code such as writing out a file, before actually shutting down My code is currently written in javascript to run under v8, but I wouldn't mind moving over to a different language if needed (it's all just an expirement). The thing I'm having a hard time getting my brain around is: how does the OS signal my long-running program and re-enter into its code? Part of my problem, I'm sure, is that I know how to do this sort of thing under Windows, but I think that I'm might be missing some key concepts under linux. I've already read up on init.d scripts, run-levels and such, but I'm still not able to answer this question. I'm hoping someone can help me pull the pieces together. (HowTos)