From 9cfa13c59a5a7c207b32375cdeaa7c150bef07ea Mon Sep 17 00:00:00 2001 From: deajan Date: Fri, 5 Jul 2019 22:56:03 +0200 Subject: [PATCH] Rebuilt targets --- dev/debug_osync.sh | 127 +++++++++++++++++++++++++-------------------- install.sh | 73 ++++++++++---------------- osync.sh | 127 +++++++++++++++++++++++++-------------------- 3 files changed, 168 insertions(+), 159 deletions(-) diff --git a/dev/debug_osync.sh b/dev/debug_osync.sh index 23727d0..d43b455 100755 --- a/dev/debug_osync.sh +++ b/dev/debug_osync.sh @@ -43,7 +43,7 @@ CONFIG_FILE_REVISION_REQUIRED=1.3.0 # CleanUp no #__WITH_PARANOIA_DEBUG _OFUNCTIONS_VERSION=2.3.0-dev-postRC2 -_OFUNCTIONS_BUILD=2019052203 +_OFUNCTIONS_BUILD=2019070502 _OFUNCTIONS_BOOTSTRAP=true if ! type "$BASH" > /dev/null; then @@ -92,8 +92,28 @@ if [ "$SLEEP_TIME" == "" ]; then # Leave the possibity to set SLEEP_TIME as envi SLEEP_TIME=.05 fi +# The variables SCRIPT_PID and TSTAMP needs to be declared as soon as the program begins. The function PoorMansRandomGenerator is needed for TSTAMP (since some systems date function does not give nanoseconds) + SCRIPT_PID=$$ +# Get a random number of digits length on Windows BusyBox alike, also works on most Unixes that have dd +function PoorMansRandomGenerator { + local digits="${1}" # The number of digits to generate + local number + + # Some read bytes can't be used, se we read twice the number of required bytes + dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do + number=$number$(printf "%d" "'$char") + if [ ${#number} -ge $digits ]; then + echo ${number:0:$digits} + break; + fi + done +} + +# Initial TSTMAP value before function declaration +TSTAMP=$(date '+%Y%m%dT%H%M%S').$(PoorMansRandomGenerator 5) + LOCAL_USER=$(whoami) LOCAL_HOST=$(hostname) @@ -126,52 +146,10 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi -# Get a random number on Windows BusyBox alike, also works on most Unixes that have dd, if dd is not found, then return $RANDOM -function PoorMansRandomGenerator { - local digits="${1}" # The number of digits to generate - local number - local isFirst=true - - if type dd >/dev/null 2>&1; then - - # Some read bytes can't be used, se we read twice the number of required bytes - dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do - if [ $isFirst == false ] || [ $(printf "%d" "'$char") != "0" ]; then - number=$number$(printf "%d" "'$char") - isFirst=false - fi - if [ ${#number} -ge $digits ]; then - echo ${number:0:$digits} - break; - fi - done - elif [ "$RANDOM" -ne 0 ]; then - echo $RANDOM - else - Logger "Cannot generate random number." "ERROR" - fi -} -function PoorMansRandomGenerator { - local digits="${1}" # The number of digits to generate - local number - - # Some read bytes can't be used, se we read twice the number of required bytes - dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do - number=$number$(printf "%d" "'$char") - if [ ${#number} -ge $digits ]; then - echo ${number:0:$digits} - break; - fi - done -} - -# Initial TSTMAP value before function declaration -TSTAMP=$(date '+%Y%m%dT%H%M%S').$(PoorMansRandomGenerator 5) - # Default alert attachment filename ALERT_LOG_FILE="$RUN_DIR/$PROGRAM.$SCRIPT_PID.$TSTAMP.last.log" @@ -443,6 +421,11 @@ function KillAllChilds { function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -2696,8 +2679,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow function call checks #__WITH_PARANOIA_DEBUG if [ "$_PARANOIA_DEBUG" == true ];then #__WITH_PARANOIA_DEBUG @@ -2871,6 +2854,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -3080,8 +3068,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow function call checks #__WITH_PARANOIA_DEBUG if [ "$_PARANOIA_DEBUG" == true ];then #__WITH_PARANOIA_DEBUG @@ -3243,6 +3231,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -3685,8 +3678,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow function call checks #__WITH_PARANOIA_DEBUG if [ "$_PARANOIA_DEBUG" == true ];then #__WITH_PARANOIA_DEBUG @@ -3860,6 +3853,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -4390,8 +4388,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow function call checks #__WITH_PARANOIA_DEBUG if [ "$_PARANOIA_DEBUG" == true ];then #__WITH_PARANOIA_DEBUG @@ -4516,6 +4514,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -5322,8 +5325,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow function call checks #__WITH_PARANOIA_DEBUG if [ "$_PARANOIA_DEBUG" == true ];then #__WITH_PARANOIA_DEBUG @@ -5497,6 +5500,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -5651,8 +5659,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow function call checks #__WITH_PARANOIA_DEBUG if [ "$_PARANOIA_DEBUG" == true ];then #__WITH_PARANOIA_DEBUG @@ -5777,6 +5785,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" diff --git a/install.sh b/install.sh index bac6133..8035b09 100755 --- a/install.sh +++ b/install.sh @@ -18,7 +18,7 @@ INSTANCE_ID="installer-$SCRIPT_BUILD" ## Please adapt this to fit your distro needs _OFUNCTIONS_VERSION=2.3.0-dev-postRC2 -_OFUNCTIONS_BUILD=2019052203 +_OFUNCTIONS_BUILD=2019070502 _OFUNCTIONS_BOOTSTRAP=true if ! type "$BASH" > /dev/null; then @@ -63,8 +63,28 @@ if [ "$SLEEP_TIME" == "" ]; then # Leave the possibity to set SLEEP_TIME as envi SLEEP_TIME=.05 fi +# The variables SCRIPT_PID and TSTAMP needs to be declared as soon as the program begins. The function PoorMansRandomGenerator is needed for TSTAMP (since some systems date function does not give nanoseconds) + SCRIPT_PID=$$ +# Get a random number of digits length on Windows BusyBox alike, also works on most Unixes that have dd +function PoorMansRandomGenerator { + local digits="${1}" # The number of digits to generate + local number + + # Some read bytes can't be used, se we read twice the number of required bytes + dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do + number=$number$(printf "%d" "'$char") + if [ ${#number} -ge $digits ]; then + echo ${number:0:$digits} + break; + fi + done +} + +# Initial TSTMAP value before function declaration +TSTAMP=$(date '+%Y%m%dT%H%M%S').$(PoorMansRandomGenerator 5) + LOCAL_USER=$(whoami) LOCAL_HOST=$(hostname) @@ -97,52 +117,10 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi -# Get a random number on Windows BusyBox alike, also works on most Unixes that have dd, if dd is not found, then return $RANDOM -function PoorMansRandomGenerator { - local digits="${1}" # The number of digits to generate - local number - local isFirst=true - - if type dd >/dev/null 2>&1; then - - # Some read bytes can't be used, se we read twice the number of required bytes - dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do - if [ $isFirst == false ] || [ $(printf "%d" "'$char") != "0" ]; then - number=$number$(printf "%d" "'$char") - isFirst=false - fi - if [ ${#number} -ge $digits ]; then - echo ${number:0:$digits} - break; - fi - done - elif [ "$RANDOM" -ne 0 ]; then - echo $RANDOM - else - Logger "Cannot generate random number." "ERROR" - fi -} -function PoorMansRandomGenerator { - local digits="${1}" # The number of digits to generate - local number - - # Some read bytes can't be used, se we read twice the number of required bytes - dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do - number=$number$(printf "%d" "'$char") - if [ ${#number} -ge $digits ]; then - echo ${number:0:$digits} - break; - fi - done -} - -# Initial TSTMAP value before function declaration -TSTAMP=$(date '+%Y%m%dT%H%M%S').$(PoorMansRandomGenerator 5) - # Default alert attachment filename ALERT_LOG_FILE="$RUN_DIR/$PROGRAM.$SCRIPT_PID.$TSTAMP.last.log" @@ -402,6 +380,11 @@ function KillAllChilds { function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" diff --git a/osync.sh b/osync.sh index 7f54ff0..a33708a 100755 --- a/osync.sh +++ b/osync.sh @@ -14,7 +14,7 @@ CONFIG_FILE_REVISION_REQUIRED=1.3.0 _OFUNCTIONS_VERSION=2.3.0-dev-postRC2 -_OFUNCTIONS_BUILD=2019052203 +_OFUNCTIONS_BUILD=2019070502 _OFUNCTIONS_BOOTSTRAP=true if ! type "$BASH" > /dev/null; then @@ -59,8 +59,28 @@ if [ "$SLEEP_TIME" == "" ]; then # Leave the possibity to set SLEEP_TIME as envi SLEEP_TIME=.05 fi +# The variables SCRIPT_PID and TSTAMP needs to be declared as soon as the program begins. The function PoorMansRandomGenerator is needed for TSTAMP (since some systems date function does not give nanoseconds) + SCRIPT_PID=$$ +# Get a random number of digits length on Windows BusyBox alike, also works on most Unixes that have dd +function PoorMansRandomGenerator { + local digits="${1}" # The number of digits to generate + local number + + # Some read bytes can't be used, se we read twice the number of required bytes + dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do + number=$number$(printf "%d" "'$char") + if [ ${#number} -ge $digits ]; then + echo ${number:0:$digits} + break; + fi + done +} + +# Initial TSTMAP value before function declaration +TSTAMP=$(date '+%Y%m%dT%H%M%S').$(PoorMansRandomGenerator 5) + LOCAL_USER=$(whoami) LOCAL_HOST=$(hostname) @@ -93,52 +113,10 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi -# Get a random number on Windows BusyBox alike, also works on most Unixes that have dd, if dd is not found, then return $RANDOM -function PoorMansRandomGenerator { - local digits="${1}" # The number of digits to generate - local number - local isFirst=true - - if type dd >/dev/null 2>&1; then - - # Some read bytes can't be used, se we read twice the number of required bytes - dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do - if [ $isFirst == false ] || [ $(printf "%d" "'$char") != "0" ]; then - number=$number$(printf "%d" "'$char") - isFirst=false - fi - if [ ${#number} -ge $digits ]; then - echo ${number:0:$digits} - break; - fi - done - elif [ "$RANDOM" -ne 0 ]; then - echo $RANDOM - else - Logger "Cannot generate random number." "ERROR" - fi -} -function PoorMansRandomGenerator { - local digits="${1}" # The number of digits to generate - local number - - # Some read bytes can't be used, se we read twice the number of required bytes - dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do - number=$number$(printf "%d" "'$char") - if [ ${#number} -ge $digits ]; then - echo ${number:0:$digits} - break; - fi - done -} - -# Initial TSTMAP value before function declaration -TSTAMP=$(date '+%Y%m%dT%H%M%S').$(PoorMansRandomGenerator 5) - # Default alert attachment filename ALERT_LOG_FILE="$RUN_DIR/$PROGRAM.$SCRIPT_PID.$TSTAMP.last.log" @@ -398,6 +376,11 @@ function KillAllChilds { function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -2542,8 +2525,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow debugging from command line with _DEBUG=true @@ -2708,6 +2691,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -2914,8 +2902,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow debugging from command line with _DEBUG=true @@ -3068,6 +3056,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -3502,8 +3495,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow debugging from command line with _DEBUG=true @@ -3668,6 +3661,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -4192,8 +4190,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow debugging from command line with _DEBUG=true @@ -4309,6 +4307,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -5110,8 +5113,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow debugging from command line with _DEBUG=true @@ -5276,6 +5279,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp" @@ -5427,8 +5435,8 @@ fi ## If the same program gets remotely executed, add _REMOTE_EXECUTION=true to it's environment so it knows it has to write into a separate directory ## This will thus not affect local $RUN_DIR variables if [ "$_REMOTE_EXECUTION" == true ]; then - mkdir -p "$RUN_DIR/$PROGRAM.remote" - RUN_DIR="$RUN_DIR/$PROGRAM.remote" + mkdir -p "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + RUN_DIR="$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" fi ## allow debugging from command line with _DEBUG=true @@ -5544,6 +5552,11 @@ function RemoteLogger { } function CleanUp { if [ "$_DEBUG" != true ]; then + # Removing optional remote $RUN_DIR that goes into local $RUN_DIR + if [ -d "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" ]; then + rm -rf "$RUN_DIR/$PROGRAM.remote.$SCRIPT_PID.$TSTAMP" + fi + # Removing all temporary run files rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP" # Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements) rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp"