I see a lot of people are using the following command:
nohup ./sendData.sh >logs/send.log 2>&1 &
Since the nohup
has already been used, do I still need to add &
on the trail?
nohup tells the terminal to not hang up, even when the parent terminal is closed. &
tells the terminal to send the process to the background. So
command &
will send the command
to the background. You can then use the shell to invoke other commands
. If the terminal is exited, the jobs are killed.
nohup command
will not send the command
to the background, but when you close the terminal, the process will live on until it is finished or killed.
nohup command &
will send the command
to the background and the process will not be killed even when you close the terminal. Usually when using nohup, one also wants the process to be in the background, that's why you see the combination of nohup and &
more often than not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With