I am using sbatch
to run scripts, and I want the output text to be written in a file from a certain point, i.e. I want to echo some text so the user can see, but after a certain command I want all output to be written in a file. Is there a way to do it?
If not, how can I disable entirely the output logging?
EDIT: Example:
#!/bin/bash
#SBATCH --partition analysis
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 1
#SBATCH --exclusive
#SBATCH --time 14-0
#SBATCH -c1
#SBATCH --mem=400M
#SBATCH --job-name jupyter
module load jupyter
## get tunneling info
XDG_RUNTIME_DIR=""
ipnip=$(hostname -i)
echo "
Copy/Paste this in your local terminal to ssh tunnel with remote
-----------------------------------------------------------------
ssh -N -L 7905:$ipnip:7905 USER@HOST
-----------------------------------------------------------------
"
##UP UNTIL HERE ECHO TO TERMINAL
##FROM NOW ON, ECHO TO A FILE
## start an ipcluster instance and launch jupyter server
jupyter-notebook --no-browser --port=7905 --ip=$ipnip