Is there any way I can cleanly log a user out without killing their process?
I am not quite sure what you mean with "cleanly". To log a user out the classical method is to terminate (that is: use the kill-command to send a SIGTERM signal to the process) the login shell of this user.
Note, that you use SIGTERM (kill -15) rather than SIGKILL (kill -9). Signal 15 tells the process to kill itself (after reasonably cleaning up) and well-behaved processes do exactly that: they clean up their stuff - temporary files, inter-process communication facilities, forked children, etc. - and then quit.
Only ill-behaved (read: badly programmed programs) processes or ones in real deep trouble (deadlocks, ...) ignore this signal and have to be killed with signal 9, which is not a real signal but a command to the OS to kindly purge the process from existence without giving it any chance of intervention.
To log out a certain user without any detriment to the OS do the following:
This will take care even of the processes started with nohup.
I have a stubborn process on my OpenBSD box that just refuses to die. It is taking up about half a meg of memory and refuses to die. It appears to be an errant gzip process that was executed from the console on 06 Jan 2002.
Here is a snippet of my attempts to kill the gzip process
... (7 Replies)
in aix, do a who -uH, by seeing the pts/number, we can do a
ps -ef | grep pts/number to see what processes the terminal is running, then how do we kill them? (3 Replies)
can I do
ps -ef | grep <process_name>
and kill the process is it exists?
and send a mail to me that the process was found and killed
Thanks much...
KS (4 Replies)
I can kill running processes on my linux red hat system using ctrl-c but cannot do it from command line of another terminal using kill -2 pid. Although I can kill them from command line using kill -9 pid and other signals. I would like to do it using the kill -2 pid.
Thanks for your suggestions (6 Replies)
Hello,
I need to create a process that will kill a specific process if it's running. Let's just say the process is called win, actually called something else. It could be running multiple times on the machine and I would want to kill them all. Below is the code I have written so far, and it... (6 Replies)
Hi Friends,
I am new to this forum as well as new to shell scripting.
I have a problem here and i need someone to solve this.
Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument .
There is a... (1 Reply)
Hi,
First, I am running a scipt.While the script is running I realize that I dont want the script to be run so I am killing the script externally.Before the process gets terminated or killed it should delete all the temporary files created by the script.How to do this?Can anyone help me?
... (3 Replies)
Hi friends,
i m in big trouble....
i have one script which connects two server ...like below..
script1.sh
-------------------------------------
bash test.sh &
eval x=$@
export x=`echo $x`
#echo $x
#
ssh user@8.2.5.6 bash /mbbv/location/script.sh $x|sed '/Binary file/d'... (1 Reply)
I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time.
Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Hi ,
I have a list of application process id's.
Is there a way to kill all the process listed below using the script, except the once which are starting with " Genesis "
adm 1522 ABC_Process.tra
adm 1939 Genesis_Process.tra
adm 2729 Genesis_Archive.tra
adm 3259 xyz_Process.tra (5 Replies)