Closed dsiminiuk closed 3 years ago
Playing around further, I modified the print functions and removed the -ne and -n flags from echo and removed the \r from printok. Now I can pipe the output to mailx without tr and the text appears in the body as expected.
function printprog {
echo "${PROGRESS} $@"
}
function printok {
echo "${OK} $@"
}
function printfail {
echo "${FAIL} $@"
}
function printinfo {
echo "${INFO} $@"
I know you put a lot of work into making the console output pretty with color and it looks great. I just want to simplify.
Thank you.
Script output doesn’t tell too much. It’s intentionally simple (no command stdout/stderr) and ”pretty”. There is more detailed plaintext logfile available for every execution of the script. Check logpath from xo-install.cfg.
I think you can achieve this with those logfiles quite easily.
I'm really only interested that the build script ran, if there was a new git version, and if it finished OK.
Hmmm. I think I have an old xo-install.cfg because there is no LOGPATH variable. I've carried the original .cfg from my original installation to latest. I have LOGFILE="$(dirname $0)/xo-install.log"
But I see LOGPATH in the most recent sample.xo-install.cfg so I will add that to mine.
I'll give it a try. Thanks
I understand. Unfortunately i think this need is quite marginal and actually the first time it’s proposed so wont be refactoring the logging functionality at this time.
LOGFILE is indeed older variable and was replaced by the LOGPATH when logging was done pretty much completely again.
Let me know if there’s any further questions about this.
I personally like to have logs of various activities emailed to me to see what is going on in my systems. I redirect the script output to a date/time named logfile to capture activity in /var/log/xo/xo-install_yyyymmdd-hhmm.log. But the log file contains ANSI color codes/escape characters which causes the file to appear like an attachment when piping it to mail/mailx. My current workaround is to modify the xo-install.sh script by setting the color variables to null strings.
Even with that change, I still need to pipe the file through tr to make the mail client see the text as a non-binary.
Ideally, I would like the script to be able to email me directly, a plain text body of the STD OUT/ERR. Alternatively, an argument to send plain text to STD OUT/ERR. Other ideas are welcome of course.