PDA

View Full Version : Unix/MacOSX client should trap sigkill/quit/HUP and shutdown properly



mikkyo
09-18-2002, 04:05 PM
When running in quiet mode, there should be no need to remove the foldtrajlite.lock file to shutdown the client, a sigquit/kill or HUP (unless nohup'd) should shutdown the client properly.
See man 2 sigaction if unfamiliar with signals.
If handling of these signals is implemented, telling the client to quit, rebooting, and shutdown will all behave properly without losing the completed tasks.

Brian the Fist
09-18-2002, 06:02 PM
1. There are proper ways to shut the client down when running in quiet mode, why do you wish to not follow them?

2. SIGKILL and SIGSTOP cannot be caught, at least on linux. SIGTERM and SIGINT, what you should normally use to kill a process are caught and should (I think) effectively do the same thing as removing the .lock file. I could potentially add SIGQUIT to this list but have never seen that one used myself and I don't encourage killing any process when it gives you such an easy way of doing it nicely.

mikkyo
09-18-2002, 06:59 PM
Originally posted by Brian the Fist

1. There are proper ways to shut the client down when running in quiet mode, why do you wish to not follow them?
Because it requires an extra step, which should not be needed.
If someone else reboots the machine (or a UPS shuts it down when the power goes out), no one is there to do rm foldtrajlite.lock, and wait for the process to terminate.

2. SIGKILL and SIGSTOP cannot be caught, at least on linux. SIGTERM and SIGINT, what you should normally use to kill a process are caught and should (I think) effectively do the same thing as removing the .lock file. I could potentially add SIGQUIT to this list but have never seen that one used myself and I don't encourage killing any process when it gives you such an easy way of doing it nicely.

Sorry, you are correct. I meant SIGTERM not SIGKILL.
Under OS X (Im not positive about linux, but Im sure some variants support this) SIGQUIT is sent when the machine is rebooted or halted, and then a SIGKILL to processes that havent exited.
If a user trys to kill a process it is sent SIGTERM unless they specify SIGKILL(or another signal).
So by trapping SIGTERM and SIGQUIT, I could reboot or shutdown my machine without ever having to remove the .lock file as foldtrajlite would be user friendly and exit nicely. Not only that, but were I running the client under my login and had to log out to let someone else use the machine, the client would terminate nicely. This would pretty much eliminate the need for the user to worry about having to shut down the client at all. To me that is the "easy way of doing it".
:)

Brian the Fist
09-19-2002, 10:47 AM
Ok, I see right now it actually kills your data if it gets a sigterm. I will add it to the wishlist then.

Scoofy12
09-19-2002, 01:22 PM
You could probably just have it do the same thing it does when when its running as an NT service and you shut down; just saves your work and exits quickly without trying to upload. this way you could put it in your startup script on a linux box, and when linux shuts down it will send sigterm and you wont lose your data, and dont have to delete the lock file and wait.

Next on the wish list: convince Microsoft to send sigterm to a dos box when you shutdown windows 98! :jester: