Skip to content

Commit

Permalink
[ALS-5305] Update windows sync start (#136)
Browse files Browse the repository at this point in the history
Co-authored-by: Venkatesan Chandrababu <vnkcha@amazon.com>
  • Loading branch information
srpiatt and venkatch4 authored Nov 14, 2023
1 parent 15edac4 commit e21d7c0
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 e21d7c0

Please sign in to comment.