dev:shellscripts:logando_tudo_shellscript_faz_um_arquivo
Logando tudo que o shellscript faz para um arquivo de log
#!/bin/bash LOG_LOCATION=/var/log/scripts/logs exec > >(tee -i $LOG_LOCATION/MylogFile.log) exec 2>&1 echo "Log Location should be: [ $LOG_LOCATION ]"
You can add this line on top of your script:
#!/bin/bash # redirect stdout/stderr to a file exec &> logfile.txt
OR else to redirect only stdout use:
exec > logfile.txt
dev/shellscripts/logando_tudo_shellscript_faz_um_arquivo.txt · Last modified: 2022/11/04 00:34 by 127.0.0.1