Jenkins service restart issue

Issue:

If Jenkins fails to restart with error “System error 1067 has occurred.

Solution:

  • Download latest Jenkins war from https://jenkins-ci.org/
  • Keep it program files folder (e.g. C:\Program Files (x86)\Jenkins)
  • Start Jenkins (java -jar jenkins.war)
  • Check console, olf jobs would not be there.
  • Now stop this Jenkins instace (Cntrl +C)
  • Now start old instance through service, it should start normally and old jobs should appear at console.

Shell custom log colorizer

How to run

./logScript.sh (Default tail parameter = 50)

./logScript 1000 (User defined tail parameter)

 

log_colorizer.properties

LOG_FILE=”/<PathToLogDir>/<LogFileName>”;
LOG_TAIL_PARAM=50

DIR_TEMP=”tmp”;

OLD_FILE_TIMER=”5″;


Script:

#source property file
. log_colorizer.properties

#Getting tail parameter as argument
TEMP_LOG_TAIL_PARAM=$1

#Checking if passed argument is null
if [ "$TEMP_LOG_TAIL_PARAM" != '' ]; then
 LOG_TAIL_PARAM="$1"
fi


#Clearning old temp files
find $DIR_TEMP/ -name 'tmp*' -type f -mmin +$OLD_FILE_TIMER -delete

#Creating temp file to keep track of what is printed
TEMP_FILE=`mktemp $DIR_TEMP/tmp.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`

#Infinite loop
while :
do
 TEMP=`tail -$LOG_TAIL_PARAM $LOG_FILE`

#File separator
IFS='
'
 for item in $TEMP
 do

#Checking if current line is already printed
 if ! grep -qF "$item" $TEMP_FILE ; then
 #Appending colors in front of various key parameters
 echo $item | perl -pe 's/.*info.*/\e[1;32m$&\e[0m/g;s/.*debug.*/\e[1;33m$&\e[0m/g;s/.*\*\*\*\*\ Error.*/\e[1;31m$&\e[0m/g;s/.*Warning.*/\e[1;36m$&\e[0m/g;s/.*HTTP request.*/\e[1;35m$&\e[0m/g;s/.*<?xml.*/\e[1;35m$&\e[0m/g'
 fi

 done

#Redirect currently read tail content to a temp file
 echo $TEMP > $TEMP_FILE
 sleep 1
done