diff --git a/src/FlubuCore/Tasks/Linux/SystemCtlTask.cs b/src/FlubuCore/Tasks/Linux/SystemCtlTask.cs index 3accf8d2..15a58fd9 100644 --- a/src/FlubuCore/Tasks/Linux/SystemCtlTask.cs +++ b/src/FlubuCore/Tasks/Linux/SystemCtlTask.cs @@ -7,11 +7,19 @@ public class SystemCtlTask : TaskBase { private readonly string _command; private readonly string _service; + private readonly string _host; - public SystemCtlTask(string command, string service) + /// + /// Control systemd services. + /// + /// Command to execute (start, stop, status, ...) + /// Execute command for service unit. + /// Execute command on a remote host. + public SystemCtlTask(string command, string service, string host) { _command = command; _service = service; + _host = host; } protected override string Description { get; set; } @@ -25,6 +33,9 @@ protected override int DoExecute(ITaskContextInternal context) if (DoNotFail) task.DoNotFailOnError(); + + if (!string.IsNullOrEmpty(_host)) + task.WithArguments("-H", _host); return task.Execute(context); }