sub get_data_from_proc_fs{ opendir(PROC,"/proc"); @PROC = readdir PROC; closedir(PROC); @pid = grep /[0-9]/, @PROC; for($k=0;$k<@PID;$k++){ open(STAT,"<","/proc/$PID[$k]/stat"); ($STAT) = <STAT>; push(@app,(split(" ",$STAT))[1]); push(@pgrp,(split(" ",$STAT))[4]); close(STAT); open(CMDLINE,"<","/proc/$PID[$k]/cmdline") ; ($CMDLINE) = <CMDLINE>; push(@cmd,$CMDLINE); close(CMDLINE); } $/ = "\0"; chomp(@cmd); $/ = "\n"; } #####some code here# &get_data_from_proc_fs ; &get_system_date ; $a = 0 ; $PROC_FS_NEW = 0 ; while( $a < $PS_MONITOR ){ $b = 0 ; $found = 0 ; while( $b < $PS_PROC_FS ){ if( ($cmd_monitor[$a] eq $cmd[$b]) && ($pgrp[$b] eq $pid[$b]) +){ if( $first_time == 1 ){ $status = "NORMAL" ; $process = "${app[$b]}_${pid[$b]}" ; &print_status_info($process,$cmd[$b],$pid[$b]) ; $found++ ; } &save_info_about_running_processes_to_monitor ; $PROC_FS_NEW++ ; } $b++ ; } if(( $found == 0 ) && ( $first_time == 1 )){ $status = "ERROR" ; &print_status_info($app_m[$a],$cmd_m[$a]) ; } $a++ ; #####code continues...#
In reply to Re^4: Equal strings don't match!
by pl
in thread Equal strings don't match!
by pl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |