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.
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.
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
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:
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.