It is possible to do something like this:
nohup ./run.sh > /dev/null 2>&1 &
Which sends the process to background, discards its output and allows us to close terminal.
Is there any possible way to do that using the script itself? I mean, I would execute this:
and somewhere inside the script, can we do something like this:
nohup "$0" > /dev/null 2>&1 &
So that when the script is run, it will act same as above?
I suppose we can have two separate scripts for this. However, is it possible to do in a single script?
I'm asking because the script will be called from the system, and I don't want to change how the system calls the script, I'd prefer I change how the script is executed.