Capturing the killed process logs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capturing the killed process logs
# 1  
Old 09-05-2012
Capturing the killed process logs

I have two set of questions.
1) To skip killing some process automatically.

2) To kill other process and capture their log.

I have set of process, some needs to be killed gracefully and others should be skipped.

Listed are the process.
Code:
 
adm 1522 ABC_DE-BillingAgreement-2012-07-11-Agreement.tra
adm 1939 ABC_DE-GenesisHTTPandSOAPAdapter-2012-05-19-Genesis_Process.tra
adm 2729 ABC_DE-SpecialKenan-2012-05-17-Kenan_Archive.tra

adm 2729 ABC_DE-Gracefull-2012-05-17-Grace-Process.tra 
adm 2729 ABC_DE-Peacefull-2012-05-17-Peace-Process.tra


To Skip killing some process :
====================
From the above listed process first 3 process should not be killed, and others should be killed gracefully.
For which i have the below script. Can any one tell me if it works (or) needs any modifications.
Code:
grep -v -E "BillingAgreement | GenesisHTTPandSOAPAdapter | SpecialKenan" inputfile | cut -d" " -f2 | xargs kill

To capture the logs of other killed processes:
==============================
Logs are located in "/var/prod/logs" directory as
Code:
ABC_DE-Gracefull-2012-05-17-Grace-Process.log
ABC_DE-Peacefull-2012-05-17-Peace-Process.log

The killed processes get re-started automatically.
Once the process are killed,they logs will read as "stopped" and once re-started it reads as "started"
Example:
Code:
ENGINE-002 Engine  ABC_DE-Gracefull-2012-05-17-Grace-Process stopped
ENGINE-002 Engine  ABC_DE-Gracefull-2012-05-17-Grace-Process started

ENGINE-001 Engine  ABC_DE-Peacefull-2012-05-17-Peace-Process stopped
ENGINE-001 Engine  ABC_DE-Peacefull-2012-05-17-Peace-Process started

How can i capture these logs once they have stopped (or) started.
# 2  
Old 09-10-2012
If you have process name in a file you can just select them with a grep rather excluding others.. either way it will work..

How much time will it take the killed process to restart automatically? You can keep a watch say via sleep then check for process via
Code:
ps -ef

command and then make entries into the log accordingly.

Give it a try.... Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for capturing FTP logs

I have a script #!/bin/bash HOST=ftp.example.com USER=ftpuser PASSWORD=P@ssw0rd ftp -inv $HOST <<EOF user $USER $PASSWORD cd /path/to/file mput *.html bye EOF the script executes sucessfully I need to capture the FTP logs to a logfile should contain FTP Login successful ... (1 Reply)
Discussion started by: rajeshas83
1 Replies

2. UNIX for Beginners Questions & Answers

Help with Capturing time from Autosys logs

Hi Guys, I'm very new to Shell scripting and have to design a code which I'm not able to find a way to. I will try to explain the aim in detail and shall be obliged if anyone could help me with the coding snippet. I have an input file who's every row has a few details about an autosys Job. I shall... (1 Reply)
Discussion started by: Crusnik02
1 Replies

3. Shell Programming and Scripting

Help in capturing Time from Autosys Logs

Hi Guys, I'm very new to Shell scripting and have to design a code which I'm not able to find a way to. I will try to explain the aim in detail and shall be obliged if anyone could help me with the coding snippet. I have an input file who's every row has a few details about an autosys Job. I shall... (0 Replies)
Discussion started by: Crusnik02
0 Replies

4. Emergency UNIX and Linux Support

Capturing console (/dev/ttyS1) logs

Hi, I have been trying to capture console logs from the init script. When the ramfs is mounted, i check if usb is connected , if conncted, i mount it and redirected the console logs like so: cat & /dev/ttyS1 >> /mnt/logs.txt I'm getting /bin/sh : /dev/ttyS1 :permission denied ... (8 Replies)
Discussion started by: xerox
8 Replies

5. UNIX for Dummies Questions & Answers

Process Killed : Need to find why ?

Hi reader, I'm making a tool out of korn shell script that is running on a HP-UX server. But everytime i invoke the tool, it gets killed after a while (mid-process). I have tried re-running it a couple of times but each invocation ending up the same way .. following is a snippet of the o/p... (8 Replies)
Discussion started by: clakkad
8 Replies

6. Shell Programming and Scripting

Capturing FTP logs

Hi Guys, I am trying to capture the FTP Logs in a log file. I am using the below code. ftp -d -n -v $Remote_Host << EOD > $Ftp_LOG; Since iam running the script in debug mode, i am able to see that the ftp is done and the file has been transferred. But the log file does not have... (7 Replies)
Discussion started by: mac4rfree
7 Replies

7. UNIX for Dummies Questions & Answers

Protect a Process from Being Killed

Hi, I have a process which takes 13-15 mins for execution and its getting killed in the meantime.So can you please helpme out how to protect the process from getting killed. Thanks in advance. Regards, Harika (9 Replies)
Discussion started by: harikagrp
9 Replies

8. UNIX for Dummies Questions & Answers

SAS Process Getting Killed

HI all, I am very new to AIX (matter of fact Unix). We are currently automating out manual process using Unix Shell Scripting. My wrote a shell script which will accept the name of the sas job as parameter, checks the existense of the sas file in the specified folder. If it is not present,... (1 Reply)
Discussion started by: anubhav2020
1 Replies

9. Solaris

how to run a killed process

hi, i am creating a daemon process for updating the file at regular interval.one problem with this is if anybody kills the daemon it wont update the file.anybody have idea how to rerun the daemon if it killed.the code is written in c++ in solaries environment. thnaks & regards suresh (8 Replies)
Discussion started by: suresh_rtp
8 Replies

10. UNIX for Dummies Questions & Answers

process not getting killed

I have a process that is in the sleeping state "S" and I have tried to stop it with a run control script that I use to stop/start it - but it does not stop. I have tried kill -9 <PID of process> with no change. I imagine that this process is sleeping with the kernel. It does not respond to... (5 Replies)
Discussion started by: finster
5 Replies
Login or Register to Ask a Question