From c16b285afc781269b7fb48337f37f452bb0c1593 Mon Sep 17 00:00:00 2001
From: Fabrice Le Goff <fabrice.le.goff@cern.ch>
Date: Thu, 23 Jun 2022 12:01:59 +0200
Subject: [PATCH] prod tools: fix file path to run from anywhere

---
 ProductionTools/installed/castor.checklogs      | 2 +-
 ProductionTools/installed/castor.greplogs       | 2 +-
 ProductionTools/installed/castor.logdir         | 2 +-
 ProductionTools/installed/castor.logsfreq       | 2 +-
 ProductionTools/installed/castor.notrunning     | 2 +-
 ProductionTools/installed/castor.ps             | 2 +-
 ProductionTools/installed/castor.starttime      | 2 +-
 ProductionTools/installed/castor.stopall        | 2 +-
 ProductionTools/installed/castor.updateconflist | 6 +++---
 9 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ProductionTools/installed/castor.checklogs b/ProductionTools/installed/castor.checklogs
index f003be9..1dc1b45 100755
--- a/ProductionTools/installed/castor.checklogs
+++ b/ProductionTools/installed/castor.checklogs
@@ -3,7 +3,7 @@
 # Prints every log file name of a running CastorScript instance
 # if the log file size is non empty
 
-for c in `cat castor.confs`; do
+for c in `cat ~/castor.confs`; do
 	logdir=$(grep LogDir: $c | awk '{print $NF}' | tr -d "'")
 	logdir=${logdir%/} # remove trailing slash
 	lsl=$(ls -l `echo "$logdir/*.log"` 2>/dev/null)
diff --git a/ProductionTools/installed/castor.greplogs b/ProductionTools/installed/castor.greplogs
index 25452de..e64b5d5 100755
--- a/ProductionTools/installed/castor.greplogs
+++ b/ProductionTools/installed/castor.greplogs
@@ -7,7 +7,7 @@ if [ x"$1" = x ]; then
 fi
 TOGREP=$1
 
-CASTOR_CONFS="`cat castor.confs`"
+CASTOR_CONFS="`cat ~/castor.confs`"
 if [ x"$2" != x ]; then
 	CASTOR_CONFS=`echo -e "$CASTOR_CONFS" | grep $2`
 fi
diff --git a/ProductionTools/installed/castor.logdir b/ProductionTools/installed/castor.logdir
index f35e1a8..7e0b5d4 100755
--- a/ProductionTools/installed/castor.logdir
+++ b/ProductionTools/installed/castor.logdir
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-CASTOR_CONFS="`cat castor.confs`"
+CASTOR_CONFS="`cat ~/castor.confs`"
 if [ x"$1" != x ]; then
 	CASTOR_CONFS=`echo -e "$CASTOR_CONFS" | grep $1`
 fi
diff --git a/ProductionTools/installed/castor.logsfreq b/ProductionTools/installed/castor.logsfreq
index 9300cb0..1b8945b 100755
--- a/ProductionTools/installed/castor.logsfreq
+++ b/ProductionTools/installed/castor.logsfreq
@@ -13,7 +13,7 @@ if [ x"$2" != x ]; then
 	NB_DAYS=$2
 fi
 
-CASTOR_CONFS="`cat castor.confs`"
+CASTOR_CONFS="`cat ~/castor.confs`"
 if [ x"$3" != x ]; then
 	CASTOR_CONFS=`echo -e "$CASTOR_CONFS" | grep $3`
 fi
diff --git a/ProductionTools/installed/castor.notrunning b/ProductionTools/installed/castor.notrunning
index 4e1b2af..4aecffa 100755
--- a/ProductionTools/installed/castor.notrunning
+++ b/ProductionTools/installed/castor.notrunning
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-for c in `cat castor.confs`; do
+for c in `cat ~/castor.confs`; do
 	m=`echo $c | awk -F '/' '{print $4}'`
 	ssh -x -o ConnectTimeout=1 $m "ps -ef | grep CastorScript | grep $c | grep -v grep &>/dev/null || echo \"not running: $m $c\""
 done
diff --git a/ProductionTools/installed/castor.ps b/ProductionTools/installed/castor.ps
index de06aa7..ea7bb64 100755
--- a/ProductionTools/installed/castor.ps
+++ b/ProductionTools/installed/castor.ps
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-for c in `cat castor.machines`; do
+for c in `cat ~/castor.machines`; do
 	echo "$c"
 	ssh -x -o ConnectTimeout=1 $c "ps -ef | grep CastorScript | grep -v grep"
 done
diff --git a/ProductionTools/installed/castor.starttime b/ProductionTools/installed/castor.starttime
index b2c50ef..6f29339 100755
--- a/ProductionTools/installed/castor.starttime
+++ b/ProductionTools/installed/castor.starttime
@@ -1,4 +1,4 @@
 #!/usr/bin/env bash
-for c in `cat castor.machines`; do
+for c in `cat ~/castor.machines`; do
 	ssh -x -o ConnectTimeout=1 $c "ps -eo lstart,args | grep CastorScript | grep -v grep"
 done
diff --git a/ProductionTools/installed/castor.stopall b/ProductionTools/installed/castor.stopall
index 7c50545..4afd24c 100755
--- a/ProductionTools/installed/castor.stopall
+++ b/ProductionTools/installed/castor.stopall
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-for c in `cat castor.machines`; do
+for c in `cat ~/castor.machines`; do
 	echo "$c"
 	ssh -x -o ConnectTimeout=1 $c "/sw/castor/tools/castor.signal 12"
 done
diff --git a/ProductionTools/installed/castor.updateconflist b/ProductionTools/installed/castor.updateconflist
index 15ee8c3..fa19699 100755
--- a/ProductionTools/installed/castor.updateconflist
+++ b/ProductionTools/installed/castor.updateconflist
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
-find /daq_area/castor/*/atlascdr/ -name '*.cfg' > castor.confs
-find /mnt/daq_area_rw/castor/*/atlascdr/ -name '*.cfg' > castor.WRITABLE.confs
-awk -F'/' '{print $4}' < castor.confs | sort | uniq > castor.machines
+find /daq_area/castor/*/atlascdr/ -name '*.cfg' > ~/castor.confs
+find /mnt/daq_area_rw/castor/*/atlascdr/ -name '*.cfg' > ~/castor.WRITABLE.confs
+awk -F'/' '{print $4}' < ~/castor.confs | sort | uniq > ~/castor.machines
 
 # Machines on which there are several instances
 # awk -F'/' '{print $4}' < castor.confs | sort | uniq -d
-- 
GitLab