Kill by date


 
Thread Tools Search this Thread
Operating Systems Solaris Kill by date
# 1  
Old 04-27-2006
Kill by date

From time to time, we have users that remain logged in for days. Me being a DBA and not a Solaris SysAdmin person, have no clue how to kill a process based on the date/time stamp from the ps -ef command.

I might not even be making any sense.

For example, if a person as been logged in for more than 12 hours I want to kill that process. How do I use the kill command to do that?

I guess I forgot to mention that it's possible for us to have more than 40 processes to "weed through", so I prefer to do this with one command and not have to issue the kill command for ever process.

Last edited by teeroy65; 04-27-2006 at 11:12 AM..
# 2  
Old 04-27-2006
This is not as straighforward as you think. Killing a user session means killing the process that the user logged in with. I mean, if the users login using telnet, then you have to check all telnetd processes for a process that may be older than 12 hours, and kill it.
So you need to tell us how users login (telnet/ssh/something else) i.e. what process to search for.
# 3  
Old 04-28-2006
This should give you some insight:

http://www.sun.com/bigadmin/scripts/...killLogins.txt
# 4  
Old 04-28-2006
Quote:
For example, if a person as been logged in for more than 12 hours I want to kill that process. How do I use the kill command to do that?
Depending on what shell you are on, there is another "scriptless" fashion to get the job done, just set the TMOUT environment variable on the "target's login profile" or just try it on a ksh prompt
Code:
shell$ export TMOUT=5  # will logout after 5mn

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies

2. Solaris

Cannot kill a process with kill -9

Hello everyone, I have a process that I want to kill. I have tried kill-9 PID but it doesn't work. I have tried preap PID but it doesn't work too. The parent of my process is the process whose PID is 1, so I can't kill it. My OS is a Solaris 9. Can anyone help me understand what's going... (3 Replies)
Discussion started by: adilyos
3 Replies

3. Shell Programming and Scripting

Converting a date to friday date and finding Min/Max date

Dear all, I have 2 questions. I have a file with many rows which has date of the format YYYYMMDD. 1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too. 2. After converting the date to... (10 Replies)
Discussion started by: 2001.arun
10 Replies

4. Shell Programming and Scripting

Script in python to kill process by date

Hello everyone, First sorry for my english. I'm new in python and I want to create a script that allows the cleaning of a directory (/ tmp), files corresponds to a specific process according to the date. Steps: 1 - I have to find all processes of a program running, eg OpenOffice,... (0 Replies)
Discussion started by: doudoubens
0 Replies

5. Linux

Kill a process without using kill command

I want to Kill a process without using kill command as i don't have privileges to kill the process. I know the pid and i am using Linux 2.6.9 OS. (6 Replies)
Discussion started by: sudhamacs
6 Replies

6. Shell Programming and Scripting

Kill a process without using kill command

Sorry, posted the question in other forum. (0 Replies)
Discussion started by: sudhamacs
0 Replies

7. UNIX for Advanced & Expert Users

Diff b/n kill and kill -9

Hi, I have a process with say pid x. What is the difference b/n kill x and kill -9 x in unix Thanks Ammu (2 Replies)
Discussion started by: ammu
2 Replies

8. Programming

kill(0,-9) don't kill the process

Hi all i have simple c program , when i wish to kill the app im using kill(0,-9) , but it seams this command don't do any thing and the program. just ignore it . what im doing wrong here ? im using HP-UX ia64 Thanks (9 Replies)
Discussion started by: umen
9 Replies

9. UNIX for Dummies Questions & Answers

not able to kill find with kill -9

Hello everyone I am using HP Ux and had run a find command. Now I am trying to kill it with kill or kill -9 but it is not getting killed and still running. Any clues ? Thanks Sidhu (5 Replies)
Discussion started by: Amardeep
5 Replies

10. UNIX for Advanced & Expert Users

When kill doesnt work, how to kill a process ?

Hi All, I am unable to kill a process using kill command. I am using HP-UX system. I have tried with kill -9 and i have root privilages. How can i terminate this daemon ? ? ? Regards, Vijay Hegde (3 Replies)
Discussion started by: VijayHegde
3 Replies
Login or Register to Ask a Question