Unexpanded ofunctions

pull/167/head
deajan 5 years ago
parent 7fffa454e9
commit f8fbbaef57

@ -10,6 +10,7 @@ Run program and then use declare -p to find any leaked variables that should not
- ./shellcheck.sh ../install.sh
- ./shellcheck.sh ../osync-batch.sh
- ./shellcheck.sh ../ssh_filter.sh
- Unexpansion of main and subprograms must be done
- Arch repo must be updated
- Source must be put to download on www.netpower.fr/osync
- Tests must be run against all supported operating systems via run_tests.sh

@ -149,17 +149,17 @@ function PoorMansRandomGenerator {
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
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
}
#### PoorMansRandomGenerator SUBSET END ####
@ -491,15 +491,15 @@ function SendAlert {
return 0
fi
if [ $attachment == true ]; then
attachmentFile="$LOG_FILE"
if type "$COMPRESSION_PROGRAM" > /dev/null 2>&1; then
eval "cat \"$LOG_FILE\" \"$COMPRESSION_PROGRAM\" > \"$ALERT_LOG_FILE\""
if [ $? -eq 0 ]; then
attachmentFile="$ALERT_LOG_FILE"
fi
fi
fi
if [ $attachment == true ]; then
attachmentFile="$LOG_FILE"
if type "$COMPRESSION_PROGRAM" > /dev/null 2>&1; then
eval "cat \"$LOG_FILE\" \"$COMPRESSION_PROGRAM\" > \"$ALERT_LOG_FILE\""
if [ $? -eq 0 ]; then
attachmentFile="$ALERT_LOG_FILE"
fi
fi
fi
body="$MAIL_ALERT_MSG"$'\n\n'"Last 1000 lines of current log"$'\n\n'"$(tail -n 1000 "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log")"

Loading…
Cancel
Save