Skip to main content
added 269 characters in body
Source Link
Asain Kujovic
  • 2.2k
  • 1
  • 20
  • 24

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &                         ...when bash --version >= 4

or

>/dev/null 2>&1 &                     ...all shells

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

MinimalAssuming bash>=4, minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }

... works well for $1 value 'notepad.exe' ... but if you still want nohup for some reason, it accepts just one command, and you have 2 (setting display and runing wine), so you must wrap it inside bash:

{ nohup bash -c "DISPLAY=:11.0 wine $1" &>/dev/null & }

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

Minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }

... works well for $1 value 'notepad.exe' ... but if you still want nohup for some reason, it accepts just one command, and you have 2 (setting display and runing wine), so you must wrap it inside bash:

{ nohup bash -c "DISPLAY=:11.0 wine $1" &>/dev/null & }

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &                         ...when bash --version >= 4

or

>/dev/null 2>&1 &                     ...all shells

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

Assuming bash>=4, minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }

... works well for $1 value 'notepad.exe' ... but if you still want nohup for some reason, it accepts just one command, and you have 2 (setting display and runing wine), so you must wrap it inside bash:

{ nohup bash -c "DISPLAY=:11.0 wine $1" &>/dev/null & }
added 269 characters in body
Source Link
Asain Kujovic
  • 2.2k
  • 1
  • 20
  • 24

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

Minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }

... works well for $1 value 'notepad.exe' ... but if you still want nohup for some reason, it accepts just one command, and you have 2 (setting display and runing wine), so you must wrap it inside bash:

{ nohup bash -c "DISPLAY=:11.0 wine $1" &>/dev/null & }

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

Minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

Minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }

... works well for $1 value 'notepad.exe' ... but if you still want nohup for some reason, it accepts just one command, and you have 2 (setting display and runing wine), so you must wrap it inside bash:

{ nohup bash -c "DISPLAY=:11.0 wine $1" &>/dev/null & }
deleted 125 characters in body
Source Link
Asain Kujovic
  • 2.2k
  • 1
  • 20
  • 24

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

Minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ nohup DISPLAY=:11.0 wine "$1" &>/dev/null & }

Or just:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }

because nohup is usually not needed, nor screen, nor tmux.

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

Minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ nohup DISPLAY=:11.0 wine "$1" &>/dev/null & }

Or just:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }

because nohup is usually not needed, nor screen, nor tmux.

When detaching program, you should redirect both outputs somewhere (to /dev/null or to log file), and use:

&>/dev/null &

instead of just:

&

... so that starting ssh do not need to worry about stdout, stderr and can exit.

nohup is not always important (depending of shell config and program's hup signal handling..., in my test: 'sleep', 'xclock' and 'wine notepad.exe' continue to work without need of nohup). And in situations when nohup is needed, usually screen and tmux are better solutions.

Minimal example for testing detaching behaviour is that:

ssh 1.2.3.4 "sleep 10 &"               ... exits after 10 seconds
ssh 1.2.3.4 "sleep 10 &>/dev/null &"   ... exits immediately

In your specific script1/2situation, function fc_START_WINE_APP from script2 should be:

{ DISPLAY=:11.0 wine "$1" &>/dev/null & }
added 297 characters in body
Source Link
Asain Kujovic
  • 2.2k
  • 1
  • 20
  • 24
Loading
added 91 characters in body
Source Link
Asain Kujovic
  • 2.2k
  • 1
  • 20
  • 24
Loading
added 34 characters in body
Source Link
Asain Kujovic
  • 2.2k
  • 1
  • 20
  • 24
Loading
added 34 characters in body
Source Link
Asain Kujovic
  • 2.2k
  • 1
  • 20
  • 24
Loading
Source Link
Asain Kujovic
  • 2.2k
  • 1
  • 20
  • 24
Loading