This commit is contained in:
Frank Bischof 2024-02-21 11:45:50 +01:00
parent b5dd1cf1d0
commit f7edb019d2

View File

@ -30,11 +30,12 @@ case "$1" in
if [ "`stat ${OUTPUT} | grep Size | awk '{ print $2}'`" != 0 ] if [ "`stat ${OUTPUT} | grep Size | awk '{ print $2}'`" != 0 ]
then then
# OK - safe to delete the original input file # OK - safe to delete the original input file
echo "OK - Deleting file ${INPUT}"
rm -f ${INPUT} rm -f ${INPUT}
exit 0 exit 0
else else
# NOK - remove empty output file # NOK - remove empty output file
echo "Output file is 0 bytes! Not removing the source file" echo "CRITICAL - Output file ${OUTPUT} is 0 bytes! Not removing the source file ${INPUT}"
rm -f ${OUTPUT} rm -f ${OUTPUT}
exit 2 exit 2
fi fi
@ -45,14 +46,14 @@ case "$1" in
base64 -d ${INPUT} > ${INPUT}.temp base64 -d ${INPUT} > ${INPUT}.temp
openssl enc -d $KEYS -in ${INPUT}.temp -out ${OUTPUT} openssl enc -d $KEYS -in ${INPUT}.temp -out ${OUTPUT}
rm -f ${INPUT}.temp rm -f ${INPUT}.temp
exit
if [ "`stat ${OUTPUT} | grep Size | awk '{ print $2}'`" != 0 ] if [ "`stat ${OUTPUT} | grep Size | awk '{ print $2}'`" != 0 ]
then then
# OK - safe to delete the original input file # OK - safe to delete the original input file
echo "OK - Deleting file ${INPUT}"
rm -f ${INPUT} rm -f ${INPUT}
else else
# NOK - remove empty output file # NOK - remove empty output file
echo "Output file is 0 bytes! Not removing the source file" echo "CRITICAL - Output file ${OUTPUT} is 0 bytes! Not removing the source file ${INPUT}"
rm -f ${OUTPUT} rm -f ${OUTPUT}
exit 2 exit 2
fi fi