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.
Asked
Active
Viewed 51 times
0

moninah
- 15
Ctrl+Z
→bg
) works, but if you close the terminal, the process ends and does not work. – moninah Nov 21 '23 at 03:24disown
, 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 havebadvpn-tun2socks
so cannot test this theory. – egmont Nov 21 '23 at 17:27your 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 &
Prependnohup
if that is appropriate. Better practice is to run such commands fromcrontab
OR setup asystemd
thingy (of which I know zero (-;! ). – shellter Nov 22 '23 at 03:08command >/dev/null 2>&1 & disown
when run from a bash script, it displaysdisown: not found
in the terminal, so I preferred to usenohup command >/dev/null 2>&1 &
. Thanks everyone for the replies. – moninah Nov 23 '23 at 03:30