Interface IInitCommandOptions
Options for InitCommand.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public interface IInitCommandOptions
Syntax (vb)
Public Interface IInitCommandOptions
Remarks
ExampleMetadata: infused
Examples
var handle = new InitServiceRestartHandle();
CloudFormationInit.FromElements(InitCommand.ShellCommand("/usr/bin/custom-nginx-install.sh", new InitCommandOptions { ServiceRestartHandles = new [] { handle } }), InitService.Enable("nginx", new InitServiceOptions { ServiceRestartHandle = handle }));
Synopsis
Properties
Cwd | The working directory. |
Env | Sets environment variables for the command. |
IgnoreErrors | Continue running if this command fails. |
Key | Identifier key for this command. |
ServiceRestartHandles | Restart the given service(s) after this command has run. |
TestCmd | Command to determine whether this command should be run. |
WaitAfterCompletion | The duration to wait after a command has finished in case the command causes a reboot. |
Properties
Cwd
The working directory.
virtual string Cwd { get; }
Property Value
System.String
Remarks
Default: - Use default working directory
Env
Sets environment variables for the command.
virtual IDictionary<string, string> Env { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String>
Remarks
This property overwrites, rather than appends, the existing environment.
Default: - Use current environment
IgnoreErrors
Continue running if this command fails.
virtual Nullable<bool> IgnoreErrors { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Key
Identifier key for this command.
virtual string Key { get; }
Property Value
System.String
Remarks
Commands are executed in lexicographical order of their key names.
Default: - Automatically generated based on index
ServiceRestartHandles
Restart the given service(s) after this command has run.
virtual InitServiceRestartHandle[] ServiceRestartHandles { get; }
Property Value
Remarks
Default: - Do not restart any service
TestCmd
Command to determine whether this command should be run.
virtual string TestCmd { get; }
Property Value
System.String
Remarks
If the test passes (exits with error code of 0), the command is run.
Default: - Always run the command
WaitAfterCompletion
The duration to wait after a command has finished in case the command causes a reboot.
virtual InitCommandWaitDuration WaitAfterCompletion { get; }
Property Value
Remarks
Set this value to InitCommandWaitDuration.none()
if you do not want to wait for every command;
InitCommandWaitDuration.forever()
directs cfn-init to exit and resume only after the reboot is complete.
For Windows systems only.
Default: - 60 seconds