I have deployed a post-receive hook script and I want to get whole output logs in a file as a block starting with date. I have tried one method but it take line by line log, meaning I have to put that command against every line to get the log. Is there any way to get the whole script log once starting with date?
Script file looks like this:
#!/bin/bash any_command | ts '[%F %T]' >> /home/Man/Man_log.log second_command | ts '[%F %T]' >> /home/Man/Man_log.log third_command | ts '[%F %T]' >> /home/Man/Man_log.log see i have to put this line | ts '[%F %T]' >> /home/Man/Man_log.log against every command to get log. And I have 90 lines, so it is not a perfect way to do this. I need an efficient way, like only one line in my script which takes the output of the whole script as log and stores it to another Man_log.log file starting with the date.
What i want is similar to this.
#!/bin/bash ts '[%F %T]' >> /home/Man/Man_log.log #a command which can store logs of every command below this to a separate file starting with date any_command second_command third_command