Issue
A site name hello_world has the following threads (among others):
to_cerner
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
Cause
Within the ckconnStatus subroutine in hcicyclesavemsgs, a regular expression was matching the longer of the two threads.
/^protocol ($connS*).*$/
Resolution
I 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 = 
	close(NETCONFIG);
	foreach $proc (@procs) {
		open(CONNSTATUS,”hciconnstatus |grep ‘^$proc ‘ |”)
			|| die “Cannot access hciconnstatus”;
		$procpath = $rootpath . “/” . $site . “/exec/processes/” . $proc;
		while (
			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;
}
- Jared Parish