' Script que tiene como objetivo comparar fechas ' entre los archivos fuentes y ejecutables en una ' estructura de programacion Oracle Form & Report ' Si pasa el limite de 2 minutos, el script envia un ' alerta ' Requerimientos: ' bmail.exe, es un emisor de mail SMTP via linea de comandos ' gratuido MinutoLimiteDiferencia = 2 str_CarpetaFuente = "z:\" str_CarpetaEjecutable = "s:\" str_NombreFicheroSalida = "c:\sistema\log.txt" num_cantidad = 0 Set obj_FileSystemObject = CreateObject("Scripting.FileSystemObject") Set Command = WScript.CreateObject("WScript.Shell") Set obj_FicheroSalida = obj_FileSystemObject.CreateTextFile(str_NombreFicheroSalida,True) Set obj_CarpetaFuente = obj_FileSystemObject.GetFolder(str_CarpetaFuente) Set obj_CarpetaEjecutable = obj_FileSystemObject.GetFolder(str_CarpetaEjecutable) Set obj_FicherosFuente = obj_CarpetaFuente.Files Set obj_FicherosEjecutables = obj_CarpetaEjecutable.Files obj_FicheroSalida.Write "Fecha Inicio: " & Now() & vbCr For Each obj_FicheroFuente in obj_FicherosFuente FicheroFuente = UCase(obj_FileSystemObject.GetBaseName(obj_FicheroFuente)) ExtensionFuente = UCase(obj_FileSystemObject.GetExtensionName(obj_FicheroFuente)) For Each obj_FicheroEjecutable in obj_FicherosEjecutables FicheroEjecutable = UCase(obj_FileSystemObject.GetBaseName(obj_FicheroEjecutable)) ExtensionEjecutable = UCase(obj_FileSystemObject.GetExtensionName(obj_FicheroEjecutable)) if FicheroFuente = FicheroEjecutable and ((ExtensionFuente="FMB" and ExtensionEjecutable = "FMX") or (ExtensionFuente="RDF" and ExtensionEjecutable = "REP") or (ExtensionFuente="PLL" and ExtensionEjecutable = "PLX")) then v_diferencia = abs(DateDiff("n",obj_FicheroEjecutable.DateLastModified,obj_FicheroFuente.DateLastModified)) if v_diferencia >= MinutoLimiteDiferencia then obj_FicheroSalida.Write "Los archivos " & obj_FicheroEjecutable.Name & " - " & obj_FicheroFuente.Name & " difieren en " & ToHuman(v_diferencia) & "." & vbCr num_cantidad = num_cantidad + 1 end if Exit for end if Next Next obj_FicheroSalida.Write "Total " & num_cantidad & " archivos con diferencias." & vbCr obj_FicheroSalida.Write "Fecha Fin: " & Now() & vbCr obj_FicheroSalida.Close WScript.sleep 5000 Set obj_FicheroLog = obj_FileSystemObject.GetFile(str_NombreFicheroSalida) LogSize = obj_FicheroLog.Size If LogSize > 64 Then MsgBox("Total " & num_cantidad & " archivos con diferencias.") cmd = "c:\windows\system32\bmail.exe -s mail.dominio.com.py -p 25 -t informatica@dominio.com.py -f alerts@dominio.com.py -h -a 'Diferencia de Fuentes y Ejecutables' -m " & str_NombreFicheroSalida Command.Run (cmd) End If Function ToHuman(p_minutos) CambioUnidadTiempo = 0 if p_minutos >=60 then UnidTiempoHoras = p_minutos/60 UnidadTiempo = " Horas" CambioUnidadTiempo = 1 ToHuman=Int(UnidTiempoHoras) & UnidadTiempo end if if UnidTiempoHoras >=24 then UnidTiempoDias = UnidTiempoHoras/24 UnidadTiempo = " Dias" CambioUnidadTiempo = 1 ToHuman=Int(UnidTiempoDias) & UnidadTiempo end if if UnidTiempoDias >=30 then UnidTiempoMeses = UnidTiempoDias/30 UnidadTiempo = " Meses" CambioUnidadTiempo = 1 ToHuman=Int(UnidTiempoMeses) & UnidadTiempo end if if UnidTiempoMeses >=12 then UnidTiempoAnos = UnidTiempoMeses/12 UnidadTiempo = " Anos" CambioUnidadTiempo = 1 ToHuman=Int(UnidTiempoAnos) & UnidadTiempo end if if CambioUnidadTiempo = 0 then UnidadTiempo = " Minutos" ToHuman=p_minutos & UnidadTiempo end if End Function
lunes, 11 de noviembre de 2013
Diferencia de fecha de archivos entre carpetas ( FMB - FMX, RDF - REP, PLL - PLX )
Para aquellos auditores o desarrolladores que quieran verificar si la diferencia de fecha de los fuentes de sus programas oracle forms & Report ( fmb - rdf ) estan dentro de un margen razonable de diferencia con respecto a sus ejecutables, les paso el siguiente script en vbs:
Suscribirse a:
Entradas (Atom)