Sponsored Content
Top Forums Shell Programming and Scripting Script to Kill a Process by Name... Post 302414517 by alister on Tuesday 20th of April 2010 10:05:23 AM
Old 04-20-2010
None of the solutions provided are very good (no offense intended to their respective providers). They all check for the presence of the command name and "root" in ps output, but do not constrain their presence to their respective fields. They will fail if the command name contains "root" or "grep" (so you can't use it to kill grep, egrep, fgrep, etc). Also, when identifying priviliged processes, it's best to check for id 0 instead of the name 'root', unless you are specifically interested in "root" and not privilege in general.

If your system has pkill, with the appropriate options, it is all you need.

Regards,
Alister
 

10 More Discussions You Might Find Interesting

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

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

3. AIX

Kill IDLE Process using script !!!

Dear Friends , I am using DB2 database in AIX 5.3 server . In my server some IDLE process are generated after several times which I need to kill it manually each and every time . The process I query like following : root@bagpuss $ ps auxw|sort -r +3|head -10 USER PID %CPU %MEM ... (3 Replies)
Discussion started by: shipon_97
3 Replies

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

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

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

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

9. Shell Programming and Scripting

Kill idle Process using a script

Hi, I need a script that can automatically kill all processes named "webrepn" and "webrebw" if idle for more than 30 minutes. Then I will have a Cron Job to run the script every night or 2-3 times a day depends on how this script helps. Right now, I run "ps -ef | grep webrebn" and "kill -9... (7 Replies)
Discussion started by: MaggieL
7 Replies

10. Shell Programming and Scripting

Capture process id and kill that via script

Dear Experts , we have a script scheduled on daily basis , 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... (2 Replies)
Discussion started by: rehantayyab82
2 Replies
BlueZ(1)							   User Commands							  BlueZ(1)

NAME
pand - BlueZ Bluetooth PAN daemon DESCRIPTION
The pand PAN daemon allows your computer to connect to ethernet networks using Bluetooth. SYNPOSIS
pand <options> OPTIONS
--show --list -l Show active PAN connections --listen -s Listen for PAN connections --connect -c <bdaddr> Create PAN connection --search -Q[duration] Search and connect --kill -k <bdaddr> Kill PAN connection --killall -K Kill all PAN connections --role -r <role> Local PAN role (PANU, NAP, GN) --service -d <role> Remote PAN service (PANU, NAP, GN) --ethernet -e <name> Network interface name --device -i <bdaddr> Source bdaddr --nosdp -D Disable SDP --encrypt -E Enable encryption --secure -S Secure connection --master -M Become the master of a piconet --nodetach -n Do not become a daemon --persist -p[interval] Persist mode --cache -C[valid] Cache addresses --pidfile -P <pidfile> Create PID file --devup -u <script> Script to run when interface comes up --devdown -o <script> Script to run when interface comes down --autozap -z Disconnect automatically on exit SCRIPTS
The devup/devdown script will be called with bluetooth device as first argument and bluetooth destination address as second argument. PAN daemon February 2003 BlueZ(1)
All times are GMT -4. The time now is 06:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy