Skip to content
Snippets Groups Projects
Commit 949c97b3 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

detect profile without logfile

parent 66e78d1a
No related branches found
No related tags found
1 merge request!12detect profile without logfile
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# #
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2023-12-11 v0.1 <axel.hahn@iml.unibe.ch> first lines... # 2023-12-11 v0.1 <axel.hahn@iml.unibe.ch> first lines...
# 2023-12-14 v0.2 <axel.hahn@iml.unibe.ch> detect profile without logfile
# ====================================================================== # ======================================================================
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -16,6 +17,7 @@ logdir=/var/log/imldeployment-client ...@@ -16,6 +17,7 @@ logdir=/var/log/imldeployment-client
tmpfile=/tmp/deploystatus.log tmpfile=/tmp/deploystatus.log
typeset -i iErrors=0 typeset -i iErrors=0
typeset -i iUnknown=0
typeset -i iCount=0 typeset -i iCount=0
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -36,25 +38,35 @@ for myprofile in $( getprofiles ) ...@@ -36,25 +38,35 @@ for myprofile in $( getprofiles )
do do
iCount+=1 iCount+=1
logfile=$( ls -tr1 ${logdir}/${myprofile}__* | tail -1 ) logfile=$( ls -tr1 ${logdir}/${myprofile}__* | tail -1 )
if grep "^OK: ${myprofile}$" $logfile >/dev/null; then
echo "OK: $myprofile - $logfile" if [ -z "$logfile" ]; then
echo "UNKNOWN: $myprofile - was created but not rolled yet."
iUnknown+=1
else else
iErrors+=1 if grep "^OK: ${myprofile}$" $logfile >/dev/null; then
echo "ERROR: $myprofile - $logfile" echo "OK: $myprofile - $logfile"
echo " Last lines:" else
tail -10 "${logfile}" | sed "s#^# #g" iErrors+=1
echo echo "ERROR: $myprofile - $logfile"
echo " Last lines:"
tail -10 "${logfile}" | sed "s#^# #g"
echo
fi
fi fi
done > "$tmpfile" done > "$tmpfile"
if [ $iCount -eq 0 ]; then if [ $iCount -eq 0 ]; then
echo "Deployment No profile was created yet." echo "UNKNOWN: Deployment No profile was created yet."
else else
if [ $iErrors -eq 0 ]; then if [ $iErrors -eq 0 ]; then
echo -n "OK" if [ $iUnknown -eq 0 ]; then
echo -n "UNKNOWN"
else
echo -n "OK"
fi
else else
echo -n "ERROR" echo -n "ERROR"
fi fi
echo " Deployment ... Profiles: $iCount ... Errors: $iErrors" echo ": Deployment ... Profiles: $iCount ... Errors: $iErrors"
cat "$tmpfile" cat "$tmpfile"
fi fi
rm -f "$tmpfile" rm -f "$tmpfile"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment