You can run scripts in the background and safely redirect standard output and standard error to a log file using the command below:
nohup sh myscript.sh > myscript.log 2>&1 & disown
This creates an independent background process detached from your current terminal session. You can monitor progress anytime using:
tail -f myscript.log