Vema wrote: > > i want to write to a log file "AHDXAPI Server is now started running $now_string"; > to the following path > /proj/ahd02/CAisd/site/mods/scripts/log/init/ahdxapi.init.log > > > #!/proj/ahd02/CAisd/ActivePerl-5.6.0.618/bin/perl > #/usr/local/bin/perl
use strict; use warnings; > use POSIX qw(strftime); > > $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime; > $xapipgm = "/proj/ahd02/CAisd/site/mods/scripts/srvtst26.pl"; > > $ret = qx(pgrep -f srvtst26); > > if ( $? eq 0 ) { > $ret = qx(pgrep -f $xapipgm); > # $proc= qx(ps -e|grep svrtst26); > print "AHD XAPI SERver Running with Process ID On $now_string"; > } > else{ > open (LOG,">>/proj/ahd02/CAisd/site/mods/scripts/log/init/ahdxapi.init.log") > || Error('open', 'file'); > print LOG "AHDXAPI Server is now started running $now_string"; > close (LOG); > $ret = qx(perl $xapipgm > >>/proj/ahd02/CAisd/site/mods/scripts/log/init/ahdxapi.init.log); > } Hi Vema. You're not saying what your problem is. The code above looks like it might work, but you should use strict; # always use warnings; # usually You'll have to declare all your variables with 'my' as well. What's not working for you? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]