Error while "call nohup command &"

Advertisement

Mercury
Guest

Error while "call nohup command &"

When I try typing

> open somesession
> cd somedirectory
> call nohup somecommand &

WinScp outputs

> Searching for host...
> Connecting to host...
> Authenticating...
> Using username "someuser".
> Authenticating with pre-entered password.
> Authenticated.
> Starting the session...
> Reading remote directory...
> Session started.
> -sh: Syntax error: ";" unexpected
> Connection has been unexpectedly closed. Server sent command exit status 2.
> Session 'somesession' closed.
> No session.

The command DOES work in PuTTY. The reason is clearly "&" at the end of command.
What to do?

Reply with quote

Advertisement

Mercury
Guest

And what to do?

Well, how to circumvent this?
(I use WinSCP to start some task automatically, so I cannot use PuTTY)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: And what to do?

Mercury wrote:

Well, how to circumvent this?
(I use WinSCP to start some task automatically, so I cannot use PuTTY)
Try plink from PuTTY package.
_________________
Martin Prikryl

Reply with quote

Mercury
Guest

And what to do if I need to upload some file automatically and run some command (automatically, too)? Use two programs just for the sake of some "&"?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Mercury wrote:

And what to do if I need to upload some file automatically and run some command (automatically, too)? Use two programs just for the sake of some "&"?
What about not using the &?
_________________
Martin Prikryl

Reply with quote

zac80
Guest

Returning the prompt

Martin, is there any way I can forward a command to the remote server such that WinSCP does not hang while the command is executed? Particularly, I would like to run the command "nohup ./file.bin &".

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Returning the prompt

zac80 wrote:

Martin, is there any way I can forward a command to the remote server such that WinSCP does not hang while the command is executed? Particularly, I would like to run the command "nohup ./file.bin &".
You can workaround syntactical problem with & by invoking the command from child shell, like:
/bin/sh -c "nohup ./file.bin &"
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum