entrypoint.ps1 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #Set-PSDebug -Trace 1
  2. if (!$env:logshare) {
  3. write-host "LogShare must be defined"
  4. exit 1
  5. }
  6. if (!$env:filesshare) {
  7. write-host "FilesShare must be defined"
  8. exit 1
  9. }
  10. if (!$env:filespath) {
  11. write-host "FilesPath must be defined"
  12. exit 1
  13. }
  14. if ( (test-path("C:\ProgramData\Docker\secrets\shares.username")) -And (test-path("C:\ProgramData\Docker\secrets\shares.passwd")) ){
  15. $sh_username=Get-Content -path "C:\ProgramData\Docker\secrets\shares.username"
  16. $sh_passwd=Get-Content -path "C:\ProgramData\Docker\secrets\shares.passwd"
  17. New-SmbMapping -RemotePath $env:logshare -UserName $sh_username -Password $sh_passwd
  18. New-SmbMapping -RemotePath $env:filesshare -UserName $sh_username -Password $sh_passwd
  19. }
  20. else {
  21. New-SmbMapping -RemotePath $env:logshare
  22. New-SmbMapping -RemotePath $env:filesshare
  23. }
  24. new-item -ItemType SymbolicLink -path 'C:\Services\Analis\Log' -value $env:logshare -Force
  25. new-item -ItemType SymbolicLink -path $env:filespath -value $env:filesshare -Force
  26. if ( -Not (test-path("C:\Services\Analis\analis.conf")) ){
  27. move-item -path C:\Services\Analis\analis-default.conf -destination C:\Services\Analis\analis.conf
  28. }
  29. echo -#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=
  30. echo "log start time and args"
  31. date >> C:\Services\Analis\Log\starttime.txt
  32. echo "args are $args" >> C:\Services\Analis\Log\starttime.txt
  33. echo -#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=
  34. echo Get-SmbMapping
  35. Get-SmbMapping
  36. echo -#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=
  37. echo ls C:\Services\Analis\Log
  38. ls C:\Services\Analis\Log
  39. echo -#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=-#=
  40. echo "Starting C:\Services\Analis\AnalisServer.exe $args"
  41. cmd /S /C C:\Services\Analis\AnalisServer.exe $args
  42. ls C:\Services\Analis\
  43. cat C:\Services\Analis\fatal.log