I'd log it to a file and be sure to include pid. Then a simple file tail or grep on the pid would reveal the arguments:
use strict; use warnings; use Getopt::Long; use Log::Dispatch::FileRotate; use Log::Log4perl; my $conf = q( log4perl.category.foo = DEBUG, FileRotateAppender log4perl.appender.FileRotateAppender = Log::Dispatch::File +Rotate log4perl.appender.FileRotateAppender.filename = 667540.log log4perl.appender.FileRotateAppender.mode = append log4perl.appender.FileRotateAppender.size = 10000 log4perl.appender.FileRotateAppender.max = 5 log4perl.appender.FileRotateAppender.layout = PatternLayout log4perl.appender.FileRotateAppender.layout.ConversionPattern=[%P] % +d %M %F:%L: %m%n ); Log::Log4perl::init( \$conf ); my $log = Log::Log4perl::get_logger("foo"); my $man = undef; my $woman = undef; GetOptions( 'man' => \$man, 'woman' => \$woman, ) or die(qq{Usage: $0 [--man] [--woman]}); # Set explicit to 0 or 1 $man = ($man) ? 1 : 0; $woman = ($woman) ? 1 : 0; $log->info(qq{man=$man}) if $log->is_info(); $log->info(qq{woman=$woman}) if $log->is_info(); # ------ main ------ # then do deamon stuff __END__ $ perl 667540.pl $ cat 667540.log [3561] 2008/02/12 12:29:51 main:: 667540.pl:35: man=0 [3561] 2008/02/12 12:29:51 main:: 667540.pl:36: woman=0 $ perl 667540.pl --man $ cat 667540.log [3561] 2008/02/12 12:29:51 main:: 667540.pl:35: man=0 [3561] 2008/02/12 12:29:51 main:: 667540.pl:36: woman=0 [3574] 2008/02/12 12:30:00 main:: 667540.pl:35: man=1 [3574] 2008/02/12 12:30:00 main:: 667540.pl:36: woman=0 $ perl 667540.pl --man --woman $ cat 667540.log [3561] 2008/02/12 12:29:51 main:: 667540.pl:35: man=0 [3561] 2008/02/12 12:29:51 main:: 667540.pl:36: woman=0 [3574] 2008/02/12 12:30:00 main:: 667540.pl:35: man=1 [3574] 2008/02/12 12:30:00 main:: 667540.pl:36: woman=0 [3576] 2008/02/12 12:30:05 main:: 667540.pl:35: man=1 [3576] 2008/02/12 12:30:05 main:: 667540.pl:36: woman=1
--
Andreas

In reply to Re: Detect options of script runnning in a demon mode by andreas1234567
in thread Detect options of script runnning in a demon mode by knbknb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.