1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
   | Dim Log
Dim objFSO,FileLog,fso,ObjFile
Dim objShell
Dim Commande
Dim Tempo
 
 
MyDate = Day(Now) & "." & Year(Now) & "." & Month(Now) 
 
 
Log="C:\appli\Log\appli_"& MyDate &".log"
 
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set FileLog = FSO.CreateTextFile(Log)
 
 
'-------------------------------------------------------------------------
'Test du jour si pas dimanche la sauvegarde est annulée
'-------------------------------------------------------------------------
 
Sub Verif_Day
	Jour = weekday(now)
	msglog "0","0000","-Debut: Verification Jour"
	msglog "0","0000","INFO: Jour=" & Jour
 
	if weekday(now) <> vbSunday Then 	 
		msglog "1","0002","WARNING: Jour différent de dimanche, sauvegarde inhibée"
		WScript.Quit
	else 
		msglog "0","0000","INFO: Test jour OK (Jour=Dimanche)"
	end if
 
	msglog "0","0000","-Fin: Verification Jour"
end sub
 
 
 
'-------------------
Stop services 
'-------------------
 
Sub Arrete_Service(Nom_Service)
 
	msglog "0","0000","---Debut: Arret service " & Nom_Service
	set objShell = WScript.CreateObject("WScript.Shell") 
		Tempo=" """& Nom_Service &""" "
		Commande="net stop" & Tempo
		Wscript.echo Commande
		objShell.run(Commande)
	wscript.sleep 60000
 
	msglog "0","0000","---Fin: Arret service " & Nom_Service
 
end sub
 
'---------------------------
' Corps su script
'---------------------------
msglog "0","0000","---Debut: StopServices.vbs "
Verif_Day
Verif_lock
Arrete_Service "SSIE"
Arrete_Service "cft_cftmain"
Arrete_Service "DB2 - DB2-0"
Arrete_Service "Stream0"
Arrete_Service "Stream1"
Arrete_Service "Stream2"
Arrete_Service "Stream3"
Arrete_Service "Stream4"
Arrete_Service "Stream5"
 
msglog "0","0000","---Fin: StopServices.vbs"
FileLog.Close | 
Partager