whitebear
whitebear

Reputation: 12433

SSH direct command execution with nohup

I can directly exec the command with this.

ssh [email protected] ls -la

However I want to use command like nohup sh heavytask.sh &

Even after quitting connection this task continues works.

So,what I try this

ssh [email protected] nohup sh heavytask.sh &

However it needs to wait task finished.

Is there any solution for this purpose?

Upvotes: 0

Views: 111

Answers (1)

etuardu
etuardu

Reputation: 5516

I/O redirection should fix your issue, e.g.:

ssh [email protected] "nohup sh heavytask.sh > /dev/null 2> /dev/null < /dev/null &"

Upvotes: 1

Related Questions