I want to check the status of last command and based on the exit code, the commands will be executed further.
The last command execute was:
$hiveJob = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $hiveJobDefinition
Wait-AzureHDInsightJob -Job $hiveJob -WaitTimeoutInSeconds 5400
Get-AzureHDInsightJobOutput -Cluster $clusterName -JobId $hiveJob.JobId -StandardOutput
The output is:
Cluster : crmhdinsight
ExitCode : 0
Name : Hive: show tables;
PercentComplete :
Query : show tables;
State : Completed
StatusDirectory : 7dc4b67f-99a9-4c6b-a9f3-ffe8b4e29c7e
SubmissionTime : 7/28/2014 11:44:04
AMJobId : job_1406103802152_0053
Now, I want to execute further commands only if the exitcode is zero. How do I write an if
statement for this condition?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…