

Millennium

praxis

y2klis2

@ütb:y2k.cleanup

#
# Comment : Fix all wrong y2k dates in a prod. system
#
#***********************************************************************
#                  Variables and Constants
#***********************************************************************
ME=`basename $0`
HOST=`hostname`
WS_DATA=/tmp/data

#***********************************************************************

function mytouch
{

if [ -h $1 ]; then
 SOURCE=`rl $1`
 if [ `dirname $SOURCE` = "." ]; then
  DIR=`dirname $1`
  ln -sf ${DIR}/$SOURCE $1
 else 
  echo "ln -sf $SOURCE $1"
 fi
else
 touch -f $1
fi

}

function do_init
{
   WS_RC=0
}

function fix_y2k
{ 
  if [ $WS_RC -eq 0 ]
  then cat $WS_DATA/y2k.infected.files | while read LINE
       do
#           touch -f $LINE
	mytouch $LINE
           echo "$ME: Modifying $LINE"
       done

       if   [ $? -eq 0 ]
       then echo \
	"$ME: All files set successfully to curret date or nothing to set"
            WS_RC=0
       else echo "$ME: Problems with date setting"
            WS_RC=1
       fi
  fi
}

#***********************************************************************
#                  Mainline
#***********************************************************************

do_init  
fix_y2k

exit 0
