Class InitCommand
Command to execute on the instance.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class InitCommand : InitElement
Syntax (vb)
Public Class InitCommand
Inherits InitElement
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
Constructors
InitCommand(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
InitCommand(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
ElementType | Returns the init element type for this element. |
Methods
ArgvCommand(String[], IInitCommandOptions) | Run a command from an argv array. |
ShellCommand(String, IInitCommandOptions) | Run a shell command. |
Constructors
InitCommand(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected InitCommand(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
InitCommand(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected InitCommand(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
ElementType
Returns the init element type for this element.
public override string ElementType { get; }
Property Value
System.String
Overrides
Methods
ArgvCommand(String[], IInitCommandOptions)
Run a command from an argv array.
public static InitCommand ArgvCommand(string[] argv, IInitCommandOptions options = null)
Parameters
- argv System.String[]
- options IInitCommandOptions
Returns
Remarks
You do not need to escape space characters or enclose command parameters in quotes.
ShellCommand(String, IInitCommandOptions)
Run a shell command.
public static InitCommand ShellCommand(string shellCommand, IInitCommandOptions options = null)
Parameters
- shellCommand System.String
- options IInitCommandOptions
Returns
Remarks
Remember that some characters like
&
, |
, ;
, >
etc. have special meaning in a shell and
need to be preceded by a </code> if you want to treat them as part of a filename.