openenergymonitor / EmonScripts

Emoncms Stack Installation and Update scripts
16 stars 30 forks source link

Enhancement to log init.sh and main.sh install scripts from issue https://github.com/openenergymonitor/EmonScripts/issues/64 #182

Closed CDuffers closed 1 year ago

CDuffers commented 1 year ago

In response to issue (enhancement) https://github.com/openenergymonitor/EmonScripts/issues/64

The install.sh and main.sh have been updated to copy stdout and stderr to both the terminal and also a log file. The script echos the log file name at the beginning and end of the script 'tee -a' used in case the scripts are run multiple times In addition main.sh is changed to move the shell directive to the top of the script and to remove superfluous code after the "exit 0" in the final if statement. Also removed the exit to enable the script output to be shown using one command after the if

Example of init.sh output at the start: image

End of init.sh, including where it triggers main.sh, which shows where it's output is stored: image

main.sh doesn't show share confirmation of log file contents when the user chooses to edit the config files, but could be easily added

And then when running main.sh for the real install: image

And the end of main.sh: image

borpin commented 1 year ago

Looks good, but not sure I'd put it in /tmp/ an immediate reboot will cause it to be lost I think? Size really is not an issue.

CDuffers commented 1 year ago

True, good point. Where would be better? The openenergymonitor and emoncms don't exist on first run of init and also feel an untidy place to leave the log file. /var/log feels equally as untidy How about the home directory of the user running the command? ~/init.sh.log

borpin commented 1 year ago

How about the home directory of the user running the command

That would be my suggestion.

CDuffers commented 1 year ago

I've change the location to the home directory in the commit above. I've re-run a build from scratch and have the same outcome, albeit with the change of location. I can share screenshots if preferred.

TrystanLea commented 1 year ago

Thanks @CDuffers