Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
ksh script question re: hung processes
Name: LS Date: August 27, 2001 at 09:58:13 Pacific
Comment:
I'm looking for a way to detect a hung ftp process running on a unix server. I have the pattern to grep for in the process list and the way we determine if this particular process is "hung" is if the start time is an hour (or more) old. For example, this is the "hung" process: ecadmin 26123 26733 0.0 07:19:56 ?? 0:00.05 /usr/bin/ftp -niv ftp.companyname.com My script will be running periodically - this process started at 07:19:56, so if the time is 08:19:56 or later, I want to kill -9 26123. How can I get the difference between the process start time and the current time or is there some other unix command(s) I can use to list this process if it's over 1 hour old? I obviously can't use the cpu time because it's hung and doesn't increment. Any help would be greatly appreciated...thanks!
Name: stefan caunter Date: August 31, 2001 at 21:15:47 Pacific
Reply:
a good way to get the time difference is to use unix seconds for the date stamp, i.e. seconds since jan 1 1970. if you can work the date command and its many options to convert the hh:mm:ss from the ps line into seconds, the math is very simple to establish a hung ftp process. if you cut the hh:mm:ss fields and pass them as an argument to date -s it may be a way to start. the other thing is you could do the grep and kill on a custom log for the ftp server instead of dealing with ps. hope that helps
Summary: Hello, I have a Ksh script problem. The scrip is polling a directory every 5 mins to get a file, which contains the input line like "put abc.dat /home/test" etc. If the file contain is not empty, th...
Summary: Hi everyone, I was asked to create a ksh script which does the following: (using ksh88 on AIX) 1. Check if file transfer is finished (via sftp) 2. Check if transferred file 'xxxxMM.txt' exists where...
Summary: Can anyone tell what is wrong with the ksh script below (what it does is simply looking for files containing today's name in it's name and running a while loop to process these, ftp using .netrc). It ...