By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,278 Members | 1,502 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,278 IT Pros & Developers. It's quick & easy.

Getting value automatically.

P: 1
Hi All,

I need to get $ACTRUN and others value defined here manully by running command like ACTRUN=`cat /tmp/HOSTSTATUS| tail -1 | awk '{print $2}'`;

In short I want to cat file and assign value to all $ACT variables. Any Idea ?

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2.  
  3. $ACTRUN=78;
  4. $ACTLIMIT=10;
  5. $ACTFENCE = 0;
  6. $ACTDATE='02/18/08';
  7. $ACTTIME='19:01';
  8. $ACTSTATE='LTI';
  9. $ACTMETHOD=JW;
  10. open(FILE, "</tmp/HOSTSTATUS") || die "cannot open /tmp/HOSTSTATUS : $!\n";
  11. while ($line=<FILE>)
  12. {
  13. chomp($line);
  14. @line=split(' ',$line,11);
  15. #@line{ 'CPUID', 'RUN', 'NODE',  'LIMIT', 'FENCE', 'DATE', 'TIME',  'STATE', 'METHOD', 'DOMAIN' }=@line;
  16.  
  17. ($CPUID,$RUN,$NODE,$FTA,$LIMIT,$FENCE,$DATE,$TIME,$STATE,$METHOD,$DOMAIN)=@line;
  18. #print "$CPUID  $RUN $NODE $LIMIT $FENCE $DATE $TIME $STATE $METHOD $DOMAIN" ,"\n";
  19. print $ACTRUN;
  20. if ( $RUN == $ACTRUN ) {print "";}
  21. else { print "$CPUID is not OK run #";}
  22.  
  23. if ( $LIMIT == $ACTLIMIT ) { print  "";}
  24. else { print "$CPUID has LIMIT Problem \n";}
  25.  
  26. if ( $FENCE  == $ACTFENCE ) {print "";}
  27. else { print "$CPUID has FENCE Problem\n";}
  28.  
  29. if ( $DATE  eq  $ACTDATE ) {print "";}
  30. else { print "$CPUID has DATE Problem\n";}
  31.  
  32. if ( $TIME eq $ACTTIME ) {print "";}
  33. else { print "$CPUID has TIME Problem\n";}
  34.  
  35. if ( ${STATE}  eq ${ACTSTATE} ) {print "";}
  36. else { print "$CPUID has STATE Problem\n";}
  37.  
  38. if ( $METHOD  eq $ACTMETHOD ) {print "";}
  39. else { print "$CPUID has METHOD Problem\n";}
  40.  
  41.  
  42. #SWITCH:  {
  43. #         $RUN != $ACTRUN   { print "$CPUID RUN # ok";};
  44. #         }
  45.  
  46. }
  47. close (FILE);
Feb 25 '08 #1
Share this Question
Share on Google+
1 Reply


KevinADC
Expert 2.5K+
P: 4,059
Getting value automatically.

I need to get $ACTRUN and others value defined here manu[a]lly
automatically and manually are mutually exclusive, define what you are trying to do without contradicting yourself and hopefully someone can help.
Feb 25 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.