HI
The following pl pgm executes when the process "srvtst26.pl "is stopped.
It gets started automatically started thru crontab by command "ahdxapi.init"
what i want now is i want to write to a log file with time when it gets started
"ahdxapi.init"
can any one help me on this
apprecitated ur earliest reply
xapipgm=srvtst26.pl
pgrep -f $xapipgm > /dev/null
# runrc=$?
# echo "Return Code is: $?"
if [ $? -eq 0 ]
then
set `pgrep -f $xapipgm `
echo "AHD XAPI Server ($xapipgm) Running with Process Id: $1@ ahdxapi.init.$4$5"
else
echo "AHD XAPI Server is now Started Running."
set `date '+%Y %m %d %H %M' `
xapipgm=srvtst26.pl
#echo "log: log/init/ahdxapi.init.$1$2$3.$4$5.log"
#echo "err: log/init/ahdxapi.init.$1$2$3.$4$5.err"
perl -w $xapipgm >log/init/ahdxapi.init.$1$2$3.$4$5.log
2>log/init/ahdxapi.init.$1$2$3.$4$5.err
-----Original Message-----
From: Stuart White [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 3 June 2003 9:55 AM
To: James Edward Gray II
Cc: [EMAIL PROTECTED]
Subject: Re: arrays and hashes
Hey, thanks that worked!
--- James Edward Gray II <[EMAIL PROTECTED]>
wrote:
<snip>
> I don't seen any reason to use the array at all, so
> I've removed it.
> If you had one that I just didn't know about, send
> it on back.
That's how I tried to solve this piecewise, I thought
an array was necessary, or at least, it seemed logical
to me. (another example of TMTOWTDI)
I don't understand this syntax:
$linehash{$1}++;
I understand that $linehash{$1} refers to a single key
within a key value pair of the hash, and I think the
++ is for incrementing each player's line, but I don't
understand how it works.
Could you explain it to me?
Thanks a bunch for the help! -stu
>
> > #!/usr/bin/perl
> >
> > use warnings;
> > use strict;
> >
> > open(STATS, "stats.txt") or die "statfile\n";
> > my %linehash; # removed extraneous vars
> > while (<STATS>)
> > {
> > if (/(\w+\b) (Jump Shot)/) # matches default to
> $_, so you don't have
> > to write it
> > {
> > $linehash{$1}++;
> > }
> > }
> > while (my($key,$value) = each(%linehash)) # print
> when we're all done
> > {
> > print "$key:$value\n";
> > }
>
> Hope that helps.
>
> James
>
>
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]