0

When I run the command in the terminal: sudo badvpn-tun2socks --tundev tun0 --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:8080 I get a terminal with packet data that is constantly are updated in the terminal. How can I close this terminal without closing the command process? And I need to create a bash script that would do this. Thanks.

moninah
  • 15
  • @muru Not a single solution works in a bash script. In the terminal itself, only pausing/starting the process (Ctrl+Zbg) works, but if you close the terminal, the process ends and does not work. – moninah Nov 21 '23 at 03:24
  • 1
    disown, as shown in those answers, should do the trick. If you execute that from the terminal, closing the terminal will not terminate your process. However, as you said, that process continuously produces output. Writing to its standard output or standard error, the terminal that no longer exist, results in "Input/Output error", and possibly the process decides to quit upon this error. I don't have badvpn-tun2socks so cannot test this theory. – egmont Nov 21 '23 at 17:27
  • you can redirect the disruptive output to a file (to examine later) i.e. your cmd args ... > /tmp/myCmdLog.std-out 2>/tmp/myCmdLog.std-err & OR send it to the bit-bucket (never to be seen again) i.e. yourcmd args ... >/dev/null 2>&1 & Prepend nohup if that is appropriate. Better practice is to run such commands from crontab OR setup a systemd thingy (of which I know zero (-;! ). – shellter Nov 22 '23 at 03:08
  • It's strange, but now both commands are working. Apparently I had some kind of conflict in the system. command >/dev/null 2>&1 & disown when run from a bash script, it displays disown: not found in the terminal, so I preferred to use nohup command >/dev/null 2>&1 &. Thanks everyone for the replies. – moninah Nov 23 '23 at 03:30
  • Did you try "man nohup" also? – U. Windl Nov 24 '23 at 10:56

0 Answers0