Over the years, I've had an issue with hcicyclesavemsgs not cycling SMAT files if that thread was named similar to another. I've finally taken the time to figure out the issue with hcicyclesavemsgs. I couldn't find mention of this in clovertech, so I thought I'd post this. Take this example:
IssueA site name hello_world has the following threads (among others):
When hcicyclesavemsgs runs, the logs would show the following. Notice is tries to cycle to_cerner_adt twice.
Processing
Root: /hci/cis6.1/integrator, site: hello_world, proc: hello_world, thread: to_cerner_adt
20170523.23:55:46 Cycling saved IB msg file to_cerner_adt.ibsv
cmd: hcicmd -v -p hello_world -c 'to_cerner_adt save_cycle in' >>/dev/null 2>&1
20170523.23:55:46 Backing up idx & msg files.
20170523.23:55:46 Deleting old backup idx & msg files:
20170523.23:55:46 Cycling saved OB msg file to_cerner_adt.obsv
cmd: hcicmd -v -p hello_world -c 'to_cerner_adt save_cycle out' >>/dev/null 2>&1
20170523.23:55:46 Backing up idx & msg files.
20170523.23:55:47 Deleting old backup idx & msg files:
Processing
Root: /hci/cis6.1/integrator, site: hello_world, proc: hello_world, thread: to_cerner_adt
20170523.23:55:47 No saved IB msg file for this thread
20170523.23:55:47 No saved OB msg file for this thread
CauseWithin the ckconnStatus subroutine in hcicyclesavemsgs, a regular expression was matching the longer of the two threads.
/^protocol ($connS*).*$/
ResolutionI thought a better regular expression was:
/^protocol ($conn)s{/This regular expression more explicitly matches the line it is trying to match. That is, it matches the line in the NetConfig that starts the definition of a thread (i.e. "protocol to_cerner {"). The other resolution would be to rename the thread to something dissimilar.
The full subroutine code with fix:
sub ckconnStatus {
#; check connection status
open(NETCONFIG,"grep '^protocol' $netconfig |") || return 0;
@NETCONFIG = <NETCONFIG>;
close(NETCONFIG);
foreach $proc (@procs); {
open(CONNSTATUS,"hciconnstatus |grep '^$proc ' |")
|| die "Cannot access hciconnstatus";
$procpath = $rootpath . "/" . $site . "/exec/processes/" . $proc;
while (<CONNSTATUS>) {
chop;
if (/^S+s+(S+)s+ups+S+.*$/) {
($conn) = $1;
foreach (@NETCONFIG); {
$NCline = $_;
chop($NCline);
if ($NCline =~ /^protocol ($conn)s{/) {
($conn) = $1;
printf("nProcessingn Root: %s, site: %s, proc: %s, thread: %sn",$rootpath,$site,$proc,$conn);
last;
}
}
&ckSavemsgs;
}
}
close(CONNSTATUS);
}
return 1;
}