Use a script to push logs through webdav

master
Daniel Berteaud 9 years ago
parent 3df9d8e07c
commit e3a9be246d
  1. 7
      packages/logs.xml
  2. 23
      softwares/push_logs.bat

@ -2,14 +2,11 @@
<packages>
<package id="logs"
name="Journaux d'installation"
revision="12"
revision="13"
priority="1"
execute="always">
<install timeout="5" cmd='%COMSPEC% /C if not exist "%WPKGLOGS%\logs" mkdir %WPKGLOGS%\logs' />
<install timeout="5" cmd='%COMSPEC% /C if not exist "%WPKGLOGS%\databases" mkdir %WPKGLOGS%\databases' />
<install timeout="15" cmd='%COMSPEC% /C copy /Y "%SYSTEMROOT%\system32\wpkg.xml" "%WPKGLOGS%\databases\%COMPUTERNAME%.xml"' />
<install timeout="15" cmd='%COMSPEC% /C copy /Y "%TEMP%\wpkg-%COMPUTERNAME%.log" "%WPKGLOGS%\logs\%COMPUTERNAME%.log"' />
<install timeout="15" cmd='%SOFTWARE%\logs\push_logs.bat' />
<upgrade include="install" />
<downgrade include="install" />
</package>

@ -0,0 +1,23 @@
@echo off
CALL %~dp0\..\conf\sync_conf.bat
SET DRIVE=unknown
FOR %%D IN (e f g h i j k l m n o p q r s t u v w x y z) do (
cd %%D:
IF ERRORLEVEL 1 SET DRIVE=%%D
IF ERRORLEVEL 1 goto :drivefound
)
goto :EOF
:drivefound
net use %DRIVE%: %LOGS% /USER:%USER% %PASS% 1>NUL 2>NUL
IF %ERRORLEVEL% NEQ 0 goto :EOF
IF NOT EXIST "%DRIVE%\logs" mkdir "%DRIVE%\logs"
IF NOT EXIST "%DRIVE%\databases" mkdir "%DRIVE%\databases"
copy /Y "%SYSTEMROOT%\system32\wpkg.xml" "%DRIVE%\databases\%COMPUTERNAME%.xml"
copy /Y "%TEMP%\wpkg-%COMPUTERNAME%.log" "%DRIVE%\logs\%COMPUTERNAME%.log"
net use /D %DRIVE%
Loading…
Cancel
Save