Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch background job #16

Closed
pelhu opened this issue Jun 4, 2016 · 8 comments
Closed

Launch background job #16

pelhu opened this issue Jun 4, 2016 · 8 comments

Comments

@pelhu
Copy link

pelhu commented Jun 4, 2016

Hi dear Gert.

I can not run a background task with "&" at the end of the command line. My symbol "&" is simply ignored. Could you help me please?

Cordially Khamzat

@YuryAlkevich
Copy link

I have the same problem with SshClient. Neither 'command &' nor 'nohup command &' doesn't keep alive launched command in background after end of execution of RunCommand method

@darkoperator
Copy link

darkoperator commented Apr 9, 2018 via email

@YuryAlkevich
Copy link

Thank you @darkoperator. Everything works fine via ShellStream

@sdlmw
Copy link

sdlmw commented Jul 31, 2018

Hello @YuryAlkevich

I have the same a problem with you, Could you tell me how to use ShellStream? Thank you!

arition pushed a commit to arition/SSH.NET that referenced this issue Nov 15, 2018
Fix for proxyHostname and send keepalive
@dustinkerstein
Copy link

Just wanted to see if it was possible to post a working example of a background command working. I am running into the same issue and no matter how I call my command (sh, nohup, &, etc.) it still blocks execution. Is there a simple example of ShellStream posted somewhere? Thanks!

@dustinkerstein
Copy link

dustinkerstein commented Nov 23, 2020

I managed to get the below using ShellStream working:

var stream = clientStart.CreateShellStream("input", 0, 0, 0, 0, 1000000);
Thread.Sleep(100); // Ugly but needed to wait a little or else shell isn't ready
stream.WriteLine("nohup sh -c '( ( command &>/dev/null ) & )'");

@gavin1970
Copy link

gavin1970 commented Nov 23, 2020

I have shellstream working. Maybe you can steal some ideas from here.

https://github.com/gavin1970/Linux-Commander/blob/master/Linux-Commander/common/Ssh.cs

@WojciechNagorski
Copy link
Collaborator

SSH.NET version 2024.0.0 has changed a lot. I'm closing the ticket, but if the problem still persists, please feel free to reopen or open a new ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants