Skip to content

Commit

Permalink
Update windows sync start.
Browse files Browse the repository at this point in the history
  • Loading branch information
srpiatt committed Oct 31, 2023
1 parent 15edac4 commit 0851b0f
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ Resources:
'@
Set-Content -Path c:\workdir\start-s3-synchronizer.ps1 -Value $startS3SyncScriptContent
# Source the script to start the s3 synchronizer process
."c:\workdir\start-s3-synchronizer.ps1"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$uri = [System.Uri]"${EnvironmentInstanceFiles}"
Expand All @@ -435,6 +432,17 @@ Resources:
Expand-Archive .\picsure.zip .\
Remove-Item .\picsure.zip

# Create script to Auto-Start the s3 synchronizer process after every restart
$autostartS3SyncScriptContent = @'
$action = New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument '-Windowstyle Hidden -File C:\workdir\start-s3-synchronizer.ps1'
$trigger = New-ScheduledTaskTrigger -AtLogOn
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "RunS3Synchronizer"
'@
Set-Content -Path c:\workdir\auto-start-s3-synchronizer.ps1 -Value $autostartS3SyncScriptContent
# Source the script to start the s3 synchronizer process
."c:\workdir\auto-start-s3-synchronizer.ps1"
cfn-signal.exe -e $lastexitcode --stack ${AWS::StackId} --resource EC2Instance --region ${AWS::Region}
</powershell>
Expand Down

0 comments on commit 0851b0f

Please sign in to comment.