Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Oct 18, 2023

Conversation

CDuffers
Copy link
Contributor

In response to issue (enhancement) #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

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
…that output is sent to screen and also log file
@borpin
Copy link
Contributor

borpin commented Mar 25, 2023

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
Copy link
Contributor Author

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
Copy link
Contributor

borpin commented Mar 26, 2023

How about the home directory of the user running the command

That would be my suggestion.

…ted install-scripts.md and install.md to reflect this change
@CDuffers
Copy link
Contributor Author

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 TrystanLea merged commit 6c09f8d into openenergymonitor:master Oct 18, 2023
@TrystanLea
Copy link
Member

Thanks @CDuffers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants