Getting value automatically.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dharmendrapatel
    New Member
    • Feb 2008
    • 1

    Getting value automatically.

    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 ?

    [CODE=perl]#!/usr/bin/perl -w

    $ACTRUN=78;
    $ACTLIMIT=10;
    $ACTFENCE = 0;
    $ACTDATE='02/18/08';
    $ACTTIME='19:01 ';
    $ACTSTATE='LTI' ;
    $ACTMETHOD=JW;
    open(FILE, "</tmp/HOSTSTATUS") || die "cannot open /tmp/HOSTSTATUS : $!\n";
    while ($line=<FILE>)
    {
    chomp($line);
    @line=split(' ',$line,11);
    #@line{ 'CPUID', 'RUN', 'NODE', 'LIMIT', 'FENCE', 'DATE', 'TIME', 'STATE', 'METHOD', 'DOMAIN' }=@line;

    ($CPUID,$RUN,$N ODE,$FTA,$LIMIT ,$FENCE,$DATE,$ TIME,$STATE,$ME THOD,$DOMAIN)=@ line;
    #print "$CPUID $RUN $NODE $LIMIT $FENCE $DATE $TIME $STATE $METHOD $DOMAIN" ,"\n";
    print $ACTRUN;
    if ( $RUN == $ACTRUN ) {print "";}
    else { print "$CPUID is not OK run #";}

    if ( $LIMIT == $ACTLIMIT ) { print "";}
    else { print "$CPUID has LIMIT Problem \n";}

    if ( $FENCE == $ACTFENCE ) {print "";}
    else { print "$CPUID has FENCE Problem\n";}

    if ( $DATE eq $ACTDATE ) {print "";}
    else { print "$CPUID has DATE Problem\n";}

    if ( $TIME eq $ACTTIME ) {print "";}
    else { print "$CPUID has TIME Problem\n";}

    if ( ${STATE} eq ${ACTSTATE} ) {print "";}
    else { print "$CPUID has STATE Problem\n";}

    if ( $METHOD eq $ACTMETHOD ) {print "";}
    else { print "$CPUID has METHOD Problem\n";}


    #SWITCH: {
    # $RUN != $ACTRUN { print "$CPUID RUN # ok";};
    # }

    }
    close (FILE);[/CODE]
    Last edited by eWish; Feb 25 '08, 11:28 PM. Reason: Please use [CODE][/CODE] tags
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    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.

    Comment

    Working...