I want to capture ALL the logs data, both with error messages, from my script output, and redirect them all to log file.
I have script like below:
#!/bin/bash ( echo " `date` : part 1 - start " ssh -f firstname.lastname@example.org 'bash /www/htdocs/server.com/scripts/part1.sh logout exit' echo " `date` : sleep 120" sleep 120 echo " `date` : part 2 - start" ssh email@example.com 'bash /www/htdocs/server.com/scripts/part2.sh logout exit' echo " `date` : part 3 - start" ssh firstname.lastname@example.org 'bash /www/htdocs/server.com/scripts/part3.sh logout exit' echo " `date` : END" ) | tee -a /home/scripts/cron/logs
I want to see all actions in file "/home/scripts/cron/logs"
But i see only this what i put after echo command.
How to check in logs is SSH command was successful?
I need to gather all the logs data. I need this to monitor result of every command in my script, to better analyse what's going on while script fail.