Esempio n. 1
0
        protected override bool StartJob(Job operation)
        {
            var ssh = new Chilkat.Ssh();

            if (!ssh.Connect(_domainName, _port))
            {
                return(false);
            }

            if (!ssh.AuthenticatePk(_username, _privateKey))
            {
                return(false);
            }

            var execPath = $"{_rootPath}/{operation.Method.Name}";
            var args     = new StringBuilder($"{_rootPath}/data");

            foreach (var input in operation.Input)
            {
                args.Append($" {input.Id}");
            }

            var command = $"./{execPath} {args}";
            var pid     = ssh.QuickCmdSend(command);

            if (pid < 0)
            {
                return(false);
            }
            else
            {
                _jobPids.Add(operation.Guid, pid);
            }

            return(true);
        }