Capture process id and kill that via script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capture process id and kill that via script
# 1  
Old 11-04-2013
Capture process id and kill that via script

Dear Experts ,

we have a script scheduled on daily basis ,

Code:
cd /u01/oracle/inst/apps/PROD_prodapps/admin/scripts/
./adstpall.sh apps/apps
echo " "
echo " "
echo " "
ps -ef | grep FND
pkill -9 FND
ps -ef | grep FND
pkill -9 FND
ps -ef | grep FND


but even then there are some processes which remain running after executing above script twice and this halts and delays to down oracle database.

then we manually kill these processes and then db is shutdown smoothly.

please tell how we can edit above script to kill processes automatically via some other script.

Regards

---------- Post updated at 02:56 PM ---------- Previous update was at 10:47 AM ----------

how we can store the value of process id in a file and then kill those via pkill etc ?

Last edited by Don Cragun; 11-04-2013 at 02:28 AM.. Reason: Add CODE tags.
# 2  
Old 11-04-2013
If all your processes are children of your script, use the PPID to kill them all. If that is not the case, give more details for your request.
# 3  
Old 11-04-2013
store in a file?, use redirection with > or >>
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Kill all child process of a script

Hi guys i have a problem with a script... this script creates differents GUI with YAD... well i want that when i press the "Cancel" button on this graphical interface all the child process and even the same script should be killed #!/bin/bash function gui_start { local choice="" ... (4 Replies)
Discussion started by: maaaaarco
4 Replies

2. Shell Programming and Scripting

Script does not kill the java process

Hi We have script to stop our application, all our application use this standard script to stop however in one of our application this script does not work properly. It does not kill the process, thats why we always use the manual process to kill which is to kill the process id (kill -9... (1 Reply)
Discussion started by: kaibiganmi
1 Replies

3. Shell Programming and Scripting

Cannot kill hacker process with my script

I want to kill a process of xterm that is run by hacker with my login name. So, I write a shell script to do my goal. I run 2 xterm and then I run my script on a first xterm. it should kill the process of a second xterm but it doesn't.Why? Here is my code : #!/bin/ksh myps=$(ps -f|grep... (7 Replies)
Discussion started by: thsecmaniac
7 Replies

4. Shell Programming and Scripting

Script to kill the specific process

Hi I have the process to kill regulary, but the PSID is dymatic change and not sure how to kill the specific process ID Check the tradekast_rvd is running , if such process, kill the els process id ps -e f |grep tradekast_rvd ps -ef |grep els then I kill els process id ... (2 Replies)
Discussion started by: linux_user
2 Replies

5. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

6. Shell Programming and Scripting

Script to Kill a Process by Name...

Hello all... new to these forums and a bit of a newbie with linux aswell. I need to figure out how to write a shell script to kill a process by name as given to the script as an argument. I've got that part working OK, but i need to make sure that the script does not allow processes that are... (6 Replies)
Discussion started by: cannon1707
6 Replies

7. Shell Programming and Scripting

How to track and later kill a process in a script

Hello, I am trying to write a script that turns off the screensaver for a certain period of time, then come back on. I have had it up and running for a while, but then I decided to refactor it a bit for my family members that are less computer savvy. I am starting a subshell for the "meat" of... (4 Replies)
Discussion started by: Narnie
4 Replies

8. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

9. Shell Programming and Scripting

Script to kill process...

hello Bros, I need to write some script that i can put it on crontab which checks for a process X if running. If the process X is ruuning then take the PID and kill it or display message that says process X is not running. I am using AIX 5.3 Thanks guys.:b: (2 Replies)
Discussion started by: malcomex999
2 Replies

10. Shell Programming and Scripting

Script to kill process

Hello guys, I have a process named monitoreo, with 'monitoreo start' my process start until i kill them, now i want to do 'monitoreo stop' to kill them. After 'monitoreo start' i have this process running: ps -af UID PID PPID C STIME TTY TIME CMD ati 10958 1495 ... (5 Replies)
Discussion started by: Lestat
5 Replies
Login or Register to Ask a Question