Home > Blockchain >  SSH direct command execution with nohup
SSH direct command execution with nohup

Time:08-25

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?

CodePudding user response:

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

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