From 417b3115e31bf29bb64c8c04a387960287d06c84 Mon Sep 17 00:00:00 2001 From: Erik von Reis <evonreis@caltech.edu> Date: Thu, 17 Mar 2022 18:18:32 -0700 Subject: [PATCH] RCG: some $target/chans directories if needed Create chans/ipc/<IFO>.ipc if missing during build Create chans/tmp if missing during installation --- install | 1 + src/epics/util/lib/IPCmonitor.pm | 15 +++++++++++---- src/epics/util/lib/IPCx.pm | 17 ++++++++++++----- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/install b/install index 4f4853e6d..e9ecca34c 100755 --- a/install +++ b/install @@ -60,6 +60,7 @@ if test -e $TARGET; then fi mkdir -p $TARGET/{bin,scripts,logs} +mkdir -p $RTCDS/chans/tmp chmod 775 $TARGET/logs mkdir -p $TARGET/${system}epics/burt if [ -e $RTCDS/target_archive/${system}/${system}_$cur_date/${system}epics/burt ]; then diff --git a/src/epics/util/lib/IPCmonitor.pm b/src/epics/util/lib/IPCmonitor.pm index 4a976dff5..bbcd08316 100644 --- a/src/epics/util/lib/IPCmonitor.pm +++ b/src/epics/util/lib/IPCmonitor.pm @@ -1,5 +1,6 @@ package CDS::IPCmonitor; use Exporter; +use File::Path; @ISA = ('Exporter'); #// \page IPCx IPCx.pm @@ -227,11 +228,17 @@ my @ipcxMaxNum = (-999,-999,-999,-999); # Develop name of IPC parameter file based on return from above. #my ($i) = @_; - my $iFile = $::target; - $iFile .= "/chans/ipc/"; - $iFile .= $::ifo; - $iFile .= "\.ipc"; + my $iFilePath = $::target; + $iFilePath .= "/chans/ipc/"; + my $iFile .= $iFilePath . $::ifo; + $iFile .= "\.ipc"; # Open and input data from IPC parameter file + File::Path::make_path($iFilePath); + unless (-e $iFile) + { + open(TOUCH, ">>$iFile"); + close(TOUCH); + } open(IPCIN, "<$iFile") || die "***ERROR: IPCx parameter file $iFile not found\n"; chomp(@inData=<IPCIN>); close IPCIN; diff --git a/src/epics/util/lib/IPCx.pm b/src/epics/util/lib/IPCx.pm index c111009af..cf33f6219 100644 --- a/src/epics/util/lib/IPCx.pm +++ b/src/epics/util/lib/IPCx.pm @@ -1,5 +1,6 @@ package CDS::IPCx; use Exporter; +use File::Path; @ISA = ('Exporter'); #// \page IPCx IPCx.pm @@ -331,12 +332,18 @@ if ($::ipcxCnt > 0) { # Develop name of IPC parameter file based on return from above. - #my ($i) = @_; - my $iFile = $::target; - $iFile .= "/chans/ipc/"; - $iFile .= $::ifo; - $iFile .= "\.ipc"; + #my ($i) = @_; + my $iFilePath = $::target; + $iFilePath .= "/chans/ipc/"; + my $iFile .= $iFilePath . $::ifo; + $iFile .= "\.ipc"; # Open and input data from IPC parameter file + File::Path::make_path($iFilePath); + unless (-e $iFile) + { + open(TOUCH, ">>$iFile"); + close(TOUCH); + } open(IPCIN, "<$iFile") || die "***ERROR: IPCx parameter file $iFile not found\n"; chomp(@inData=<IPCIN>); close IPCIN; -- GitLab