I'm executing PowerShell script and it can be lasted more than one hour. After one hour i'm getting TimeOut status, but my script is still running .Is there any ways to increase TimeOut limit?
Can you provide some sample code showing how you're executing the script?
@joguSD It's looks like this `$from = 'D:\Kits\Installers\Release64\UNIFI.msi'
$build = 'BUILD_NUMBER=1.9.1.030'
$SETUPEXEDIR = 'SETUPEXEDIR=D:\Kits\Installers\Release64'
$STAGEDDBSCRIPTS = 'STAGEDDBSCRIPTS=D:\Kits\Installers\Release64\StagedDBScripts.zip'
$VERSION_COMMENT = 'VERSION_COMMENT=1.9.1.030'
$ALLUSERS = 'ALLUSERS=2'
$ProductLanguage = 'ProductLanguage=1033'
$DISABLE_PREREQ = 'DISABLE_PREREQ=FALSE'
$PSEUDO_TRANS = 'PSEUDO_TRANS=FALSE'
$ORACLE_ZIP_FILENAME = 'ORACLE_ZIP_FILENAME=D:\Kits\Installers\Release64\WATDB_12C_0005.zip'
$ASM_ZIP_FILE = 'ASM_ZIP_FILE=D:\Kits\Installers\Release64\ASM_12C_0002.zip'
$DEBUG_BREAKS = 'DEBUG_BREAKS=FALSE'
$DEBUG_OPTION = 'DEBUG_OPTION=true'
$METRICS_LOGGING_ENABLED = 'METRICS_LOGGING_ENABLED=TRUE'
$INSTALLDIR = 'INSTALLDIR="D:\Program Files\Program\UNIFI"'
$INSTALL_DRIVE = 'INSTALL_DRIVE=D:\'
$DB_ROOT = 'DB_ROOT=D:\Program'
$FRA_LOCATION = 'FRA_LOCATION=D:\fast_recovery_area\UNIFI'
$SERVICE_CRED1 = 'SERVICE_CRED1=""'
$SERVICE_CRED2 = 'SERVICE_CRED2=""'
$DATABASE_IMPORT_ENABLED = 'DATABASE_IMPORT_ENABLED=FALSE'
$DATABASE_IMPORT_FILE = 'DATABASE_IMPORT_FILE=""'
$RDANCY_TYPE = 'RDANCY_TYPE=2'
$ASM_DISK_LIST = 'ASM_DISK_LIST=2,3,4'
$DATABASEBACKUPTYPE = 'DATABASEBACKUPTYPE=3'
$SERVER_TCP_PORT = 'SERVER_TCP_PORT=58070'
$HTTP_PORT = 'HTTP_PORT=58080'
$GXP = 'GXP=TRUE'
$INSTALL_TYPE = 'INSTALL_TYPE=WKG'
$REBOOT = 'REBOOT=ReallySuppress'
$DB_TYPE = 'DB_TYPE=WKG'
$path_to_perl='D:\Program\oracle\asm12c\perl\bin\perl.exe'
$path_to_clone='D:\Program\oracle\asm12c\clone\bin\clone.pl'
$oracle_home='D:\Program\oracle\asm12c'
$oracle_base='D:\Program\oracle'
$oracle_home_name='ASM12c'
Start-Process msiexec.exe -ArgumentList "/I", $from, "/q", $build, $SETUPEXEDIR, $STAGEDDBSCRIPTS, $VERSION_COMMENT, $ALLUSERS, $ProductLanguage, $DISABLE_PREREQ, $PSEUDO_TRANS, $ORACLE_ZIP_FILENAME, $ASM_ZIP_FILE, $DEBUG_BREAKS, $DEBUG_OPTION, $METRICS_LOGGING_ENABLED, $INSTALLDIR, $INSTALL_DRIVE, $DB_ROOT, $FRA_LOCATION, $SERVICE_CRED1, $SERVICE_CRED2, $DATABASE_IMPORT_ENABLED, $DATABASE_IMPORT_FILE, $RDANCY_TYPE, $ASM_DISK_LIST, $DATABASEBACKUPTYPE, $SERVER_TCP_PORT, $HTTP_PORT, $GXP, $INSTALL_TYPE, $REBOOT, $DB_TYPE
while (!(Test-Path "C:\Windows\log.txt")) { Start-Sleep 10 }
$flag = 'false'
while ($flag -eq 'false')
{
$res=Get-Content -Path C:\Windows\log.txt | Where-Object {$_ -like 'ASM Media unzipped'}
Start-Sleep -Seconds 60
if ($res -ne $null)
{
$flag = 'true'
echo $flag
}
}
Invoke-Expression -Command "$path_to_perl $path_to_clone -noconsole ORACLE_HOME=$oracle_home ORACLE_BASE=$oracle_base ORACLE_HOME_NAME=$oracle_home_name -O -nontw32FoldersActions"
$flagperl = 'false'
while ($flagperl -eq 'false')
{
$res2=Get-Content -Path C:\Windows\log.txt | Where-Object {$_ -like 'Completed install'}
Start-Sleep -Seconds 60
if ($res2 -ne $null)
{
$flagperl = 'true'
echo $flagperl
}
}
echo 1.` And works fine if I run it directly from the instance. But in AWS Console I see this http://joxi.ru/Vm6R4oEtxqobgm
Sorry for the confusion. I meant the Boto3 code, not the powershell script. From that screenshot I see that you're using AWS-RunPowerShellScript which should be able to take an executionTimeout parameter.
Something like:
Parameters={
'commands': ['yourcommands'],
'executionTimeout': ['7200'],
}
added to your send_command operation call should work.
Let me know if you need more help.
def send_power_shell_command(self, service, command):
"""
@summary: send PowerShell command to instances
@param command: PowerShell command
@param service: type of service - ssm client
@return: command execution status
"""
command_response = service.send_command(InstanceIds=self.instance_ids, DocumentName=self.document,
Parameters={"commands": [
command]}, TimeoutSeconds=40)
print '{} was sent'.format(command)
time.sleep(2)
return command_response['Command']['CommandId']
@joguSD command look like 'C:\Users\Administrator\Downloads\run_unifi_msi.ps1'
@fundorin94 Did adding the 'executionTimeout' field to the Parameters allow you to increase the timeout? It defaults to 3600 seconds.
@joguSD getting this error
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in input: "ExecutionTimeout", must be one of: InstanceIds, Targets, DocumentName, DocumentHash, DocumentHashType, TimeoutSeconds, Comment, Parameters, OutputS3Region, OutputS3BucketName, OutputS3KeyPrefix, MaxConcurrency, MaxErrors, ServiceRoleArn, NotificationConfig
executionTimeout is not a top level parameter to the operation call, it's a key in the Parameters dict.
command_response = service.send_command(
InstanceIds=self.instance_ids,
TimeoutSeconds=40,
DocumentName=self.document,
Parameters={
"commands": [command],
"executionTimeout": ["7200"]
}
)
@joguSD It helped me. Thanks!
Most helpful comment
executionTimeoutis not a top level parameter to the operation call, it's a key in theParametersdict.