General :: Kill Bash Processes "nicely"?

Dec 15, 2010

I'm trying to avoid kill -9 for the reasons described in the Useless Use of Kill -9 form letter. Is this function sufficient, or do I need to kill the kill processes after a timeout or take care of other subtleties?

soft_kill()
{
# Try to avoid forcing a kill
# @param $1: PID
kill $1 || kill -INT $1 || kill -HUP $1 ||
(echo "Could not kill $1" >&2; kill -KILL $1)
}

As an aside, what's a better name for this function? The current name reminds me of "Killing Me Softly", and manslaughter sounds a bit severe. Maybe spoon_kill (Google it)?

View 2 Replies


ADVERTISEMENT

General :: Ftp Processes - How To Kill Them With A Cron

Dec 14, 2010

if i do a

ps aux | grep ftp

that would show me at least any active ftp connects started with the ftp command, right? Is there then a way to use that to somehow kill any stuck sessions that are older than an hour?

View 9 Replies View Related

General :: How To Find And Kill Remote Processes

Oct 28, 2010

I am developing a daemon that is acting up and I am now unable to create any new processes (ie. I cannot start a new process to kill the other rogue processes). So, I need to be able to kill the processes from a remote machine. How do I do "kill" remotely without admin privileges? If I cannot kill my own process from a remote machine as a normal user then tell me so I can mark it as the correct answer.

View 3 Replies View Related

General :: Kill Remote Processes Started With SSH?

Aug 26, 2009

I've run into what is apparently an age-old SSH problem, which is that killing an ssh client process does not kill the remote process (unlike e.g. rsh). There seem to be lots of patches and a couple of open bugs on this topic that have been there for about 10 years or so... Having convinced myself by googling that there is no easy solution, I'm now looking for a workaround of some sort. I'm writing a testing framework so the processes I'm running remotely could be anything at all, i.e. I only have control of the client side. Also the remote processes are of course highly unstable and I need to be able to terminate them if they hang. ssh -t won't work for me as I don't necessarily have a terminal. Finding the remote process ID would be enough so I can do ssh <machine> kill <pid>, but I don't see any way to do that either. Just using ps, pgrep etc seems to suffer from not being able to uniquely identify the correct process, and killing the wrong process is of course very bad.

View 14 Replies View Related

General :: Kill All Idle User Processes ?

Nov 18, 2010

All the kill idle user processes scripts I've seen don't take into account that the user might have multiple sessions open. Such is the case with one of our clients. Currently, every hour or two I need to do the following:

This will get the TTY and idle time for all users.

For each idle time over a half hour, I do the following (TTY is the TTY from the previous command with a space.

I then kill those processes.

There must be a way to do this automatically in a bash or perl script. I've tried both, but can't seem to get things to work properly.

View 2 Replies View Related

General :: Kill All Processes Except Shell Window?

Aug 3, 2010

i was referring to an article given in following website.[URL] I was surprise to know that i can kill all running processes by using kill 0. However when i tried running the command nothing happened.

my machine details:

Code:

# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: EnterpriseEnterpriseServer
Description: Enterprise Linux Enterprise Linux Server release 5.2 (Carthage)
Release: 5.2
Codename: Carthage

View 4 Replies View Related

General :: Using Killall To Kill Mysql Processes?

Aug 14, 2009

I'm attempting to use 'killall' to kill all mysql processes, however after using the command mysql processes are still alive. 'killall mysql' says no processes were killed, and while 'killall mysql_safe' gives no message there are still mysql processes alive afterwards.

Code:

# killall mysql
mysql: no process killed
# killall mysqld_safe

[code].....

View 3 Replies View Related

General :: Automatically Kill Processes That Over Time Uses 95%+ Of Resources?

May 3, 2010

I don't know about your computer but when mine is working properly no process is sucking 95%+ over time. I would like to have some failsafe that kills any processes behaving like that. This comes to mind because when I woke up this morning my laptop had been crunching all night long on a stray chromium child process.

This can probably be done as a cron job, but before I make it a full time job creating something like this I'd thought I should check here. :) I hate reinventing the wheel.

View 1 Replies View Related

General :: Kill All The Processes That Have Dates Older Than Today?

Feb 11, 2011

I issue the command ps -aux | grep tony. It displays the following output

tony 10986 0.0 0.0 33532 464 ? S Feb01 0:00 vncconfig -iconic
tony 10988 0.0 0.0 86012 512 ? S Feb01 0:00 twm
tony 15553 0.0 0.0 92404 1848 ? S 10:34 0:00 sshd: tony@pts/34

[code]....

View 3 Replies View Related

General :: Writw Shell Script To Kill Processes?

Oct 19, 2010

I am trying to write a script which when executed should kill all currently running cat processes.

View 1 Replies View Related

General :: How To Tell The Kill Command To Ignore Processes If That Process Is Not Alive

Jun 18, 2010

How to tell the kill command to ignore processes if that process is not alive?

For example: 3453 is an alive process but 44534 is not.

kill -9 3453 44534

View 4 Replies View Related

General :: List And Kill Processes Accessing Internet In Linux?

Jul 28, 2011

How to kill the processes accessing Internet in background using terminal commands.Command to stop (disconnect) the processes accessing Internet.Command to kill the process accessing Internet.

View 1 Replies View Related

General :: Finding A Cmd That Will Kill All Processes That Are Accessing A Specific Filename?

Dec 16, 2009

I thought 'killall' would work, but I need to provide the "command" to kill. I'm really looking for a command that will kill all processes that have a particular file/directory open. Currently, my script fails on an 'umount' because there are several processes that have this filesystem open. The command 'lsof' is a good tool to determine which processes have a filesystem open, but I don't really want to write a script that parses through the 'lsof' output to capture PSIDs. Is there a linux command that can kill all processes that may have a particular filesystem open?

View 2 Replies View Related

General :: Detect And Kill Zombie Processes Left From The Command Line Of A Terminal?

Apr 28, 2011

how do I detect and kill zombie processes left from the command line of a Linux terminal?

View 3 Replies View Related

Ubuntu Servers :: Kill Processes With Name=x && %mem>y?

Sep 22, 2010

I have an issue on one of my servers whereby the [normally very helpful] du and tar programs are somehow using up too much or my system resources (du 40% mem, tar 20% mem) and causing problems. I am after a command which is able to kill a process without knowledge of a PID but by process name e.g. "du" and memory usage e.g. >= 10%.

Something along the lines of:
kill $(pgrep du) grep %MEM > 10

Although I know that is invalid syntax I cannot fathom the correct/best way to achieve this end!

View 9 Replies View Related

Programming :: How To Kill Zombie Processes

Dec 3, 2010

I have my code with my fork in a server and each time a client connects one more process is created. i use this code for the handling of zombies

void sig_chld(int signo){//Diadikasia gia tin diagrafi twn 'zombies'
signal( SIGCHLD, sig_chld );//signal gia ton entopismo tou zombie
pid_t pid;

[code]....

but i need the server to kill each zombie after the client is disconnecting and not to have to press ctrl+c

View 1 Replies View Related

Programming :: Perl To Kill Off Some Processes?

Nov 18, 2010

how to even start this Perl script. I have the following processes:

Command used to get this info:

ps aux --forest | grep -e process_name -e ksh | awk '{if ($1 == "user1" && $1 != "root" && $1 != "UID" && $1 != "xfs" && $1 != "mfg" && $1 != "mfgnet") print $0}'

Processes

user1 2819 0.0 0.0 4272 612 ? S Nov17 0:00 \_ -pksh-ksh
user1 2820 0.0 0.0 64956 1584 pts/833 Ss+ Nov17 0:00 \_ -ksh

[code]....

I need a way to kill off the pids 2819, 2820 because they do not have a process tied to them like pids 2918, 2922 and 6657. The way it works is peek shell (pid 2918)is opened then it starts a ksh (pid 2922) session then from there the end user runs a command (pid 6657).

View 7 Replies View Related

Ubuntu :: Emergency Command To Kill Processes?

Jun 15, 2010

I'm working with Eclipse and it's starting to misbehave now and then which completely freezes my computer. Is there any emergency command to kill such a misbehaving process so I don't have to reboot my computer?

I already have a emergency xkill icon in my taskbar and a [Ctrl]+[F1] console with "> sudo killall eclipse" pretyped(!) but sometimes it's even to late for this. What I would need is a emergency command/console that gets a guaranteed amount of process time so I can kill these process.

View 4 Replies View Related

Programming :: Kill Script Kills Too Many Processes?

Oct 21, 2010

User 1 and User 2 each start a mono process with sudo:

"sudo mono user1.exe" "sudo mono user2.exe"

Each user has a kill.sh in their directory, which is being called by user1.exe/user2.exe to kill the process.

The script itself is

ps aux | grep 'mono user1.exe' | awk '{print $1}' | xargs kill

which in theory should pull *only* the PID of "mono user1.exe" and kill only that. The problem: It kills any and every single instance of mono that is running on my system, every userx.exe thats open. I am confused, as a simple "ps aux | grep 'mono user1.exe'" does only return the mono user1.exe process and not the others. "ps aux | grep 'mono'" returns them all though. how I can modify that script so that it only kills the specific process? Would "pkill -9 -f 'mono MCuser1.exe'" work as well - or would it too kill every instance of mono? I cant do a lot more of trial and error, its not good I am killing those instances accidently...

View 14 Replies View Related

General :: Execute Three Processes By One Script In Bash?

Jun 29, 2011

how to execute three processes by one script in bash.........in linux

View 1 Replies View Related

Server :: Remove A Path - Kill The Zombie Processes - Multipath Errors?

Apr 12, 2011

i want to remove a path, but is in use.. How can i kill the zombie processes?

[Code]....

I guess i was wrong deleting first the disks that formed the path, but now how could i kill those zombie processes without a reboot?

[Code]....

View 2 Replies View Related

General :: Bash Script That Reads Files In Directory And Processes Them?

Jan 22, 2010

I am trying to create a function within my .bashrc that will process all of the files that do not end with .sh within a directory and execute them.The following is what I have so far. I am missing a way of excluding files that end with .sh though.

function startall {
for file in /etc/init.d/*.; do
"${file}" start

[code]...

View 2 Replies View Related

Fedora :: Bind C-u To Kill-whole-line In Bash Doesn't Work

Mar 19, 2010

I'd like control-u to erase the whole line, instead of only erasing backwards from the current point. I tried

bind -r "C-u"
bind -r C-u
bind -r ^U

to erase the current binding for control-u, but after running any / all of the above, bind -p still tells me

"C-u": unix-line-discard

bind "C-u":kill-whole-line doesn't work either. How can I change the binding of control-u to kill-whole-line?

View 2 Replies View Related

Programming :: Kill Follow-on Code If Source Fails In Bash?

Dec 20, 2009

I have a Bash script that runs other bash scripts. If the parent code fails, is there any way for me to also kill the child code?That kills any multiple instances of a script if I run it more than once. Is there any way I can just modify this into something that prevents the child code from running/continuing from running if the parent stops from an error?

View 3 Replies View Related

Fedora :: Shell Scripting / Bash Error Est.sh: Line 9: Kill: (20831) - No?

Jun 11, 2010

I was giving the found the following shell script. I was told it was suppose to ensure only that only one script of Test.sh can run..

However, I get it looks like it has a error when i run it... As i get Test.sh: line 9: kill: (20831) - No such process

what is going on in this script can someone explain it to me... I thought it suppose to work like a singleton for my script creating a file .run-test-sdolan. However, i don't see how or where .run-test-sdolan is create?

sdolan@staging:$ vi Test.sh
#!/bin/sh
MYDIR=`dirname $0`
CONFDIR=$HOME/
code....

View 4 Replies View Related

Ubuntu :: Phantom User Still Logged In - Bash: Kill: (5485) - No Such Process

Sep 13, 2010

$ uptime
09:55:00 up 7 days, 6 min, 2 users, load average: 0.00, 0.00, 0.00

..but I'm the only user logged in!

$ who -a
system boot 2010-09-06 09:48
run-level 2 2010-09-06 09:48 last=

[code]....

looks as though this is the culprit, but...

$ kill 5485
-bash: kill: (5485) - No such process

This process doesn't exist in the /proc folder or the output of ps. Does anyone know how this happened, and how to remove this ghost user from my system without a complete reboot? I think I have seen a similar thing on a RedHat machine ages ago but I have never figured out how to log out these ghost users.

$ uname -a

Linux ubuntu 2.6.24-28-server #1 SMP Wed Aug 25 16:07:16 UTC 2010 i686 GNU/Linux

View 9 Replies View Related

Ubuntu :: Write A Bash Script That Would Print Processes Using More Than X Mb Or X% Of The CPU?

Mar 14, 2010

i was wondering if anyone could give some advice on how to write a bash script that would print processes using more than x mb or x% of the CPU?

View 2 Replies View Related

Programming :: Bash Scripting - Display Real Name From Username Logged In + User Processes?

Jan 14, 2011

i am using putty to connect to the linux server and i am using nano as my text editor to write a bash script.

this is my script:

echo "Please enter your Username"
read userName
userName= grep $USER /etc/passwd | cut -d: -f5
echo "Welcome " $userName | cat >> output.txt

the problem i have is that when i enter my username, the output (my real name) does not display in the output.txt. instead it displays in putty. so when i run my script in putty it shows the message to enter username and after i enter my username my real name appears below it. i want it to show in the output.txt

View 1 Replies View Related

General :: Services Work Nicely With Connection Tracking - Port Range For Centos?

Dec 18, 2010

On my CentOS 5.4 box I run dns, ssh, and smtp servers. This box also has to be able to resolve and browse websites. So basically it needs iptable rules for

TCP 22 25 80 443
UDP 53

My question is, which of these services work nicely with connection tracking? I'm a little confused about how connection tracking works. For example say this iptables rule for smtp

Code:
iptables -A INPUT -s 0/0 --sport 513:65535 -d $myip --dport 25 -j ACCEPT
versus

Code:
iptables -A INPUT -s 0/0 --sport 513:65535 -d $myip --dport 25 -m state --state NEW,ESTABLISHED -j ACCEPT
So with connection tracking what exactly does it do that my first iptables rule does not do?

Also for centos is that port range correct? 2.6 Linux kernel randomly chooses a port 513-65535 when it connects to an external smtp server or say browses a site.

View 10 Replies View Related

Ubuntu :: Kill Doesn't Kill, Killall Is Powerless?

Oct 21, 2010

Today I run OpenOffice.org extensions update and it freezed fter showing me that everything was successful.When i xkilled it it refused tolaunch without any problem indication.killall soffice.bin didn't report "No process found" after 1,2,3...20 times.So I tried killall soffice.bin -i

Code:
$ sudo killall soffice.bin -i
Kill soffice.bin(3319) ? (y/N) y

[code]...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved