Unix and Linux Discussions Tagged with pid |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
7 |
13,903 |
UNIX for Beginners Questions & Answers |
|
|
|
4 |
2,031 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
7,663 |
UNIX for Beginners Questions & Answers |
|
|
|
2 |
5,515 |
UNIX for Beginners Questions & Answers |
|
|
|
5 |
2,026 |
Shell Programming and Scripting |
|
|
|
1 |
15,757 |
AIX |
|
|
|
4 |
12,342 |
Shell Programming and Scripting |
|
|
|
3 |
13,069 |
Programming |
|
|
|
1 |
2,059 |
UNIX for Dummies Questions & Answers |
|
|
|
9 |
6,640 |
HP-UX |
|
|
|
6 |
2,447 |
Shell Programming and Scripting |
|
|
|
2 |
16,100 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
25,003 |
Shell Programming and Scripting |
|
|
|
2 |
5,728 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
11,034 |
Programming |
|
|
|
4 |
6,688 |
Shell Programming and Scripting |
|
|
|
3 |
3,198 |
Shell Programming and Scripting |
|
|
|
3 |
2,303 |
Solaris |
|
|
|
2 |
6,516 |
Shell Programming and Scripting |
|
|
|
3 |
14,387 |
Programming |
|
|
|
6 |
33,222 |
Solaris |
|
|
|
1 |
4,380 |
Solaris BigAdmin RSS |
|
|
|
1 |
3,993 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
3,934 |
Shell Programming and Scripting |
|
|
|
3 |
5,306 |
Shell Programming and Scripting |
|
|
|
3 |
15,871 |
Programming |
|
|
|
0 |
2,276 |
Solaris BigAdmin RSS |
|
|
|
3 |
4,652 |
Shell Programming and Scripting |
|
|
|
2 |
12,591 |
Shell Programming and Scripting |
|
|
|
7 |
22,353 |
Shell Programming and Scripting |
|
|
|
7 |
3,912 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
15,482 |
UNIX for Dummies Questions & Answers |
|
|
|
16 |
35,491 |
UNIX for Advanced & Expert Users |
|
|
|
9 |
5,963 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
28,350 |
Shell Programming and Scripting |
|
|
|
1 |
5,740 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
2,552 |
Shell Programming and Scripting |
|
|
|
0 |
2,226 |
UNIX for Advanced & Expert Users |
|
|
|
4 |
2,300 |
Shell Programming and Scripting |
|
|
|
2 |
5,172 |
UNIX for Dummies Questions & Answers |
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)