01-10-2002
How to find a hanging pid
I am trying to write a simple shell script to find a hanging pid and kill it.Any idea how to find a hanging pid??
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I have a script which spawns multiple compilations.
Sometimes due to some errors i have to terminate that script.
Now comes the main part, how do I do that?
I can see the individual compilations via
ps -ef | grep compiler
and also kill them via
kill -9 pid
But the scirpt continues:
... (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies
2. Shell Programming and Scripting
When I run ps -aef | grep aaa.exe it gives out put
user 5091 5518 0 10:13:25 pts/1 0:00 grep aaa.exe
user 4647 2479 0 09:26:31 ? 0:25 /kk/zzz/user/xxx/bin/aaa.exe
user1 1111 2222 0 08:26:31 ? 0:25 /kk/zzz/user1/xxx/bin/aaa.exe
I need Only PID value ie... (5 Replies)
Discussion started by: madhusmita
5 Replies
3. Shell Programming and Scripting
Hi,
If I use this command netstat | grep "1268" it shows me all IP addresses connected via port 1268, which is half of what I want.
I would like to be able to then map these against a PID on the system, and also thereby get the userid.
I have done a couple of days google bashing but... (3 Replies)
Discussion started by: gcraill
3 Replies
4. Solaris
Hi Friends,
How can we find the process ID of a running process using the process name. In AIX I used to use the command "ps -ef | grep <process name>", it used to give me the owner of that process, Process ID and the threads running and the name of the process in the end.
However in... (2 Replies)
Discussion started by: sahilsardana
2 Replies
5. Shell Programming and Scripting
I want to kill a process run by a user of another group.
How do I do that..? (3 Replies)
Discussion started by: Haimanti
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I need to find the PID for a given port on the below system.
HP-UX mymachine B.11.31 U ia64 3223107173 unlimited-user license
How can I ? (4 Replies)
Discussion started by: mohtashims
4 Replies
7. HP-UX
Hi,
Is this the most appropriate way of finding the listen port number given the pid is "16659" ?
lsof -Pan -i tcp -i udp | grep 16659 | grep -i "listen"If so, how can I extract "7001" and assign it to a variable say myport=7001 from the below output which happens to be actual port number?
... (1 Reply)
Discussion started by: mohtashims
1 Replies
8. UNIX for Advanced & Expert Users
Hi,
I do not have root user credentials nor do I have the functional id of the process that uses port 80.
How can I find the pid of the process using the port number 80 ?
Operating System: Linux (6 Replies)
Discussion started by: mohtashims
6 Replies
9. Shell Programming and Scripting
Hi All,
A process completed already and I have the PID. I want to know the which command used for this PID. 'ps' command and '/proc' folder having the list current process only. Is there a way to search completed process PID?
Thanks,
Manimuthu (5 Replies)
Discussion started by: k_manimuthu
5 Replies
LEARN ABOUT DEBIAN
file::pid
File::Pid(3pm) User Contributed Perl Documentation File::Pid(3pm)
NAME
File::Pid - Pid File Manipulation
SYNOPSIS
use File::Pid;
my $pidfile = File::Pid->new({
file => '/some/file.pid',
});
$pidfile->write;
if ( my $num = $pidfile->running ) {
die "Already running: $num
";
}
$pidfile->remove;
DESCRIPTION
This software manages a pid file for you. It will create a pid file, query the process within to discover if it's still running, and remove
the pid file.
new
my $pidfile = File::Pid->new;
my $thisfile = File::Pid->new({
file => '/var/run/daemon.pid',
});
my $thisfileandpid = File::Pid->new({
file => '/var/run/daemon.pid',
pid => '145',
});
This constructor takes two optional paramters.
"file" - The name of the pid file to work on. If not specified, a pid file located in "File::Spec->tmpdir()" will be created that matches
"(File::Basename::basename($0))[0] . '.pid'". So, for example, if $0 is ~/bin/sig.pl, the pid file will be /tmp/sig.pl.pid.
"pid" - The pid to write to a new pidfile. If not specified, $$ is used when the pid file doesn't exist. When the pid file does exist, the
pid inside it is used.
file
my $pidfile = $pidfile->file;
Accessor/mutator for the filename used as the pid file.
pid
my $pid = $pidfile->pid;
Accessor/mutator for the pid being saved to the pid file.
write
my $pid = $pidfile->write;
Writes the pid file to disk, inserting the pid inside the file. On success, the pid written is returned. On failure, "undef" is returned.
running
my $pid = $pidfile->running;
die "Service already running: $pid
" if $pid;
Checks to see if the pricess identified in the pid file is still running. If the process is still running, the pid is returned. Otherwise
"undef" is returned.
remove
$pidfile->remove or warn "Couldn't unlink pid file
";
Removes the pid file from disk. Returns true on success, false on failure.
program_name
This is a utility method that allows you to determine what "File::Pid" thinks the program name is. Internally this is used when no pid file
is specified.
SEE ALSO
perl.
AUTHOR
Casey West, <casey@geeknest.com>.
COPYRIGHT
Copyright (c) 2005 Casey West. All rights reserved.
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
perl v5.8.8 2008-04-05 File::Pid(3pm)