Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

file::pid(3pm) [debian man page]

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)

Check Out this Related Man Page

card_eventmgr(1)						    PAM-PKCS#11 						  card_eventmgr(1)

NAME
card_eventmgr - PCSC-Lite Event Manager SYNTAX
card_eventmgr [debug] [[no]daemon] [timeout=<msecs>] [config_file=<filename>] [kill] [pidfile=<pidfile>] DESCRIPTION
card_eventmgr is a smart card monitoring tool that listen to the status of the card reader and dispatch actions on several events. card_eventmgr can be used for several actions: like screen lock on card removal. Three events are supported: card insertion, card removal and timeout on removed card. Actions are specified in a configuration file. OPTIONS
debug Enable debugging output. [no]daemon Runs in background if daemon or in foreground if nodaemon (default). If debug is unset, the program dettaches itself from the tty. timeout=<msecs> Set polling timeout in milliseconds. Defaults to 1000 (1 second). config_file=<configuration file> Sets de configuration file. Default value is /etc/pam_pkcs11/card_eventmgr.conf. pidfile=<pidfile> Store the card_eventmgr process ID (pid) in the file pidfile. kill Read a process id from pidfile and kill that process. You must use the argument pidfile=<pidfile> to use kill. FILES
/etc/pam_pkcs11/card_eventmgr.conf EXAMPLES
To run this program the standard way type: card_eventmgr Alternatively you can specify options: card_eventmgr debug nodaemon timeout=500 config_file=$HOME/.card_eventmgr.conf If you want to start and stop card_eventmgr automatically in an X11 session you can create a ~/.xsession file containing: # start the card autolock card_eventmgr pidfile=$HOME/.card_eventmgr.pid # start Gnome or something else /usr/bin/x-session-manager # kill the card autolock card_eventmgr kill pidfile=$HOME/.card_eventmgr.pid BUGS
Some applications like xscreensaver-command may fail due to external events (eg: try to unlock an unlocked session). In this case, the command incorrectly returns error code. AUTHORS
Juan Antonio Martinez <jonsito@teleline.es> Ludovic Rousseau <ludovic.rousseau@free.fr> SEE ALSO
pam_pkcs11(8), pkcs11_eventmgr(1), README.eventmgr, PAM-PKCS11 User Manual Juan Antonio Martinez Aug 2005 card_eventmgr(1)
Man Page