On 21/03/10 11:56, arygroup@gmail.com wrote:
On 21/03/10 13:47, Anders Johansson wrote:
On Sun, 2010-03-21 at 13:18 +0200, arygroup@gmail.com wrote:
I didn't read the kill manual, but I have a doubt. Is killing a program the same, as I close it in a legal way?
Depends on the program.
"kill" is really one of the worst named programs anywhere. It should have been called something like "signal", because that is what it does - it sends a signal to a given process. The signal INT (2) is the one sent by a shell when you press ctrl-c for example.
Most signals can be "caught" by an application, and many programs will catch the INT signal and do a controlled exit. Usually the same happens with the TERM signal, which is the default one sent by the kill command if you don't specify something else.
The HUP signal is used by some applications to trigger a re-read of the configuration without having to restart. Postfix for example uses this
Some signals can't be caught, for example SIGKILL (9). If that is sent to a process, it will exit immediately and no further instructions from it will be executed (with one exception, if the process is currently inside a kernel syscall it usually can't be interrupted, so the process will exit as soon as the syscall finishes). This should normally not be used except in extreme circumstances
How a particular program behaves when a signal is sent to it should be described in the documentation.
For modern kde and gnome applications, the intended method of sending commands to programs from scripts is with dbus.
Anders
Thanks for the explanation!
So there is no way to make what I want in a legal way if I'm not sure how all the programs in my list handle the signals, right?
It's completely legal, just a question of whether the application author did their job well and considered the needs of command-line users. SIGTERM (the default signal from kill) is simply "asking" the program to quit, so a well-written program should have plenty of time to save config etc. and shutdown cleanly. So there should be no danger to sending SIGKILL or SIGHUP to a well-written program. In fact the normal logout/shutdown process involves sending SIGTERM to all processes. On the other hand SIGKILL (kill -9) is an immediate end to the program. But anyway pidgin you can cleanly quit using /usr/bin/purple-remote "quit" (purple-remote is a program specifically for remotely controlling pidgin and other libpurple-based programs via DBUS, it should be installed with pidgin) Thunderbird seems to shutdown cleanly on a SIGHUP on my machine. Skype and dropbox you'll need to experiment with. Regards, Tejas -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org