From Sven.Schmeling@ewe.de Tue Feb 18 14:44:30 2003
Return-Path: <Sven.Schmeling@ewe.de>
Received: from localhost (localhost [127.0.0.1])
	by quequak.schmeling.de (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) with ESMTP id h1IKPG505976
	for <svschmel@localhost>; Tue, 18 Feb 2003 21:25:16 +0100
Delivered-To: sven.schmeling@myolis.de
Received: from mail.myolis.de [217.151.208.88]
	by localhost with POP3 (fetchmail-5.8.0)
	for svschmel@localhost (single-drop); Tue, 18 Feb 2003 21:25:16 +0100 (CET)
Received: (qmail 3485 invoked from network); 18 Feb 2003 13:50:28 -0000
Received: from blizzard.orgatech.de ([193.193.190.19]) (envelope-sender <Sven.Schmeling@ewe.de>)
          by davinci.teliasurf.de (qmail-ldap-1.03) with SMTP
          for <sven.schmeling@myolis.de>; 18 Feb 2003 13:50:28 -0000
Received: from mail1.ewetel.de (mail1.ewetel.de [212.6.122.14])
	by blizzard.orgatech.de (8.9.3/8.9.3) with ESMTP id OAA19215
	for <sven.schmeling@schmeling-ol.de>; Tue, 18 Feb 2003 14:45:06 +0100
Received: from hvoa0045.ewenet.de ([212.6.124.29])
	by mail1.ewetel.de (8.12.1/8.12.1) with SMTP id h1IDiVGF021799
	for <sven.schmeling@schmeling-ol.de>; Tue, 18 Feb 2003 14:44:32 +0100 (MET)
Received: from 172.20.23.169 by hvoa0045.ewenet.de (InterScan E-Mail VirusWall NT); Tue, 18 Feb 2003 14:44:32 +0100
Received: by olda0097.ewenet.de with Internet Mail Service (5.5.2653.19)
	id <1RPDAZ7X>; Tue, 18 Feb 2003 14:44:32 +0100
Message-ID: <F3E715529F14D611BDA30002A541B01E0320F8C6@OLDA0043>
From: "Schmeling, Sven" <Sven.Schmeling@ewe.de>
To: "Sven Schmeling Privat (E-Mail)" <sven.schmeling@schmeling-ol.de>
Subject: WG: osiftam
Date: Tue, 18 Feb 2003 14:44:30 +0100
Return-Receipt-To: "Schmeling, Sven" <Sven.Schmeling@ewe.de>
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain;
  charset="iso-8859-1"
X-CheckCompat: OK
X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/)
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by quequak.schmeling.de id h1IKPG505976
X-UIDL: pUQ!!Nl9"!NHn!!8Wj!!
X-UID: 1




Sven Schmeling
Abteilung IV / SAP-Basis

Telefon: 60 - 2836


-----Ursprüngliche Nachricht-----
Von: Super-User arcas5a [mailto:root@arcas5a.ewenet.de]
Gesendet: Dienstag, 18. Februar 2003 14:44
An: sven.schmeling@ewe.de
Betreff: osiftam


#!/bin/ksh
#===========================================================================
====
#
#  S C R I P T : osiftam_icama
#
#===========================================================================
====
#
#  Inhalt:
#     Dieses Script bildet den Aufrufrahmen fuer das FTAM-Tool osiftam
#     zum Holen der ICAMA-Tickets.
#
#===========================================================================
====
#
#  Aenderungsuebersicht mit Historie:
#
#  15.01.2001 / S. Schmeling	Erstellung
#
#===========================================================================
====
# set -x

#===========================================================================
====
# Ausgabe umleiten, alte Logfiles sichern
#===========================================================================
====
PROG_SHORT=`basename $0`   
ARGV1=${1}

LOGFILE=/export/home/amadat/log/log_osiftam_icama/${PROG_SHORT}.${ARGV1}.log
.`date +%d%m%Y%H%M%S`

exec 3>&1 4>&2
exec 1>${LOGFILE} 2>&1

#===========================================================================
=====
# Variablen
#===========================================================================
=====
BINPATH=/export/home/amadat/sbin
export BINPATH

PATH=$PATH:/opt/SUNWconn/bin:/usr/local/bin
export PATH

RSDBPATH=/var/SUNWconn/OSIROOT/ftam/rdb
export RSDBPATH

HOST_PREFIX="ewsd-"
export HOST_PREFIX

FTAMCMD=move
export FTAMCMD

TARGETPATH=/export/misc/nutzungsdaten_ftam/hide/V15
export TARGETPATH

ARCHIVEPATH=/export/misc/ARCHIVE/ama_files/V15
export ARCHIVEPATH

PROG_SHORT=`basename $0`                         # Programm-Name

MAILTO="guenther.tjardes@ewe.de juergen.mehlhop@ewe.de heiner.meyer@ewe.de
martin.rindchen@ewe.de olaf.bolz@ewe.de stefan.schreyer@ewe.de
youssef.oubram@ewe.de info@fssub.de klaus.dillinger@ewe.de"
export MAILTO

#===========================================================================
=====
# Environment
#===========================================================================
=====

#===========================================================================
=====
# Funktionen
#===========================================================================
=====
getfile ()
{
   GF_HOST=$1
   GF_LOCFILE=$2
   GF_REMFILE=$3
   if [ ! -f "${RSDBPATH}/${GF_HOST}.rdb" ]
   then
      echo "${PROG_SHORT} fatal: Can't open resource database file for host
\"${GF_HOST}\" !"
      return 1
   fi
   osiftam ${GF_HOST} -n 'sunbil#1' -p 'system#1' -a '' <<EOF
>/tmp/${PROG_SHORT}.$$
      ${FTAMCMD} ${GF_LOCFILE} ${GF_REMFILE}
      quit
EOF
   RETCODE=$?
   if [ ${RETCODE} -ne 0 ]
   then
      echo "${PROG_SHORT} fatal: Exit-Code \"${RETCODE}\" received by
\"osiftam\" !"
      return 1
   fi
   RETCODE=`awk 'BEGIN                     {CODE=0}
                   /FTAM diagnostic/       {CODE=CODE+1}
                   /[Ee]rror/              {CODE=CODE+1}
                 END                       {print  CODE}'
/tmp/${PROG_SHORT}.$$`
   cat /tmp/${PROG_SHORT}.$$
   rm  /tmp/${PROG_SHORT}.$$
   if [ ${RETCODE} -ne 0 ]
   then
      echo "${PROG_SHORT} fatal: Error detected in \"osiftam\" - Logfile !"
      return 1
   fi
   return 0

}

#===========================================================================
====
# Protokoll-Kopf
#===========================================================================
====
echo " ******     ****    ********  ******   **    **         **         ***
**    **  *******"
echo " **    *   **  **      **    **    **  **    **         **        **
**   **    **  **     "
echo " ******   **    **     **    **        ********  *****  **       **
**  **    **  ****** "
echo " **    *  ********     **    **        **    **         **
********  **    **  **     "
echo " **    *  **    **     **    **    **  **    **         **       **
**  **    **  **     "
echo " ******   **    **     **     *****    **    **         *******  **
**   ******   **     "

echo "\nStart der Prozedur \"$0\" am `date '+%d.%m.%y'` um `date '+%H:%M'`
Uhr. \n"

#===========================================================================
=====
# Holen der ICAMA
#===========================================================================
=====

HOST=${ARGV1}

LOOP=2
echo ""
echo "Holen der Datei \"IA.ICIAR\" vom Host \"${HOST_PREFIX}${HOST}\""
echo "==============================================================="
while [ ${LOOP} -gt 0 ]
do
   TIMESTAMP=`date '+%Y%m%d%H%M%S'`
   getfile ${HOST_PREFIX}${HOST} IA.ICIAR
${TARGETPATH}/${HOST}_icama_${TIMESTAMP}
   if [ $? -eq 0 ]
   then
      echo "Archivieren ..."
      cp ${TARGETPATH}/${HOST}_icama_${TIMESTAMP}
${ARCHIVEPATH}/${HOST}_icama_${TIMESTAMP}
      gzip ${ARCHIVEPATH}/${HOST}_icama_${TIMESTAMP}
      echo "Fertig."
      echo "Kopiere Daten zum mdbeprod ...."
      rcp -p ${TARGETPATH}/${HOST}_icama_${TIMESTAMP}
dbe3@mdbeprod:/export/nutzungsdaten_ftam/amatic/V15
      rcp -p ${ARCHIVEPATH}/${HOST}_icama_${TIMESTAMP}.gz
root@mdbeprod:/export/nutzungsdaten_ftam/amatic_archiv/V15
      echo "Kopiere Daten zum arcas4a ...."
      rcp -p ${TARGETPATH}/${HOST}_icama_${TIMESTAMP}
amadat@arcas4b:/export/misc/nutzungsdaten_ftam/hide/V15
      # Shadowfiles mitnehmen:
      rcp -p ${TARGETPATH}/${HOST}_icama_${TIMESTAMP}.shf
amadat@arcas4b:/export/misc/nutzungsdaten_ftam/hide/V15
      rcp -p ${ARCHIVEPATH}/${HOST}_icama_${TIMESTAMP}.gz
amadat@arcas4b:/export/misc/ARCHIVE/ama_files/V15
      echo "Fertig."
      echo "Lokaler Dateiname: ${ARCHIVEPATH}/${HOST}_icama_${TIMESTAMP}"
      break
   fi
   LOOP=`expr ${LOOP} - 1`
   if [ ${LOOP} -gt 0 ]
   then
	ERROR_MSG="Fehler: Holen der Datei IA.ICIAR vom Host
${HOST_PREFIX}${HOST} wird wiederholt"

   	echo ""
   	echo ${ERROR_MSG}
   	echo
"===========================================================================
============"

   	cat ${LOGFILE} | mailx -s "${ERROR_MSG}" ${MAILTO}
   	sleep 30
   else
	ERROR_MSG="Fehler: Holen der Datei IA.ICIAR vom Host
${HOST_PREFIX}${HOST} wird abgebrochen"

   	echo ""
   	echo ${ERROR_MSG}
   	echo
"===========================================================================
============="

   	cat ${LOGFILE} | mailx -s "${ERROR_MSG}" ${MAILTO}
   	sleep 30
   fi

done

#===========================================================================
====
# Ausgabeumlenkung restaurieren
#===========================================================================
====
echo "\n\nFertig am `date '+%d.%m.%y'` um `date '+%H:%M'` Uhr. \n"

exec 1>&3 3>&-
exec 2>&4 4>&-

#===========================================================================
====
#  Script-Ende
#===========================================================================
====



