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

load-to-blink1.sh fails after recent system restart #30

Open
ctgreybeard opened this issue Dec 26, 2012 · 0 comments · May be fixed by mjbrooks/blink1#1
Open

load-to-blink1.sh fails after recent system restart #30

ctgreybeard opened this issue Dec 26, 2012 · 0 comments · May be fixed by mjbrooks/blink1#1

Comments

@ctgreybeard
Copy link

I discovered that the uptime message is variable length depending on how long it has been since a system restart. My current uptime reads:

23:09pm up 2:04, 3 users, load average: 0.66, 0.56, 0.47

which causes load-to-blink1.sh to fail.

I have a fix almost ready, it's a simple fix.

I need to clean up my git clone before I can submit it.

Please assign this to me.

mjbrooks added a commit to mjbrooks/blink1 that referenced this issue Mar 20, 2022
System restart changes the length of output and seems to have caused some issues in at least one reported case.

In addition, it occurred to me that three separate calls to uptime were itself problematic for two reasons:
    1) The load values for all three measurements would change with each call, even though we were only looking at one of the values each time, it isn't consistent with the broader idea of acting on what the measurements are at a specific moment in time
    2) We are responding to load, making three separate calls to uptime and awk just contributes to more of it (however minuscule)

Considering all of the above, I've changed it so we grab the values for load1, load5 and load15 from /proc/loadavg in one pass. This avoids any issue with variable output length from uptime and makes it a single lighter-weight query that represents a snapshot from a single moment in time.

My apologies for the belated update, @ctgreybeard posted an issue but I was not @ mentioned and never saw it. I was just scrolling through ages-old contributions and other code and happened to see it just now. But hey, what's 10 years between friends?!

resolves todbot#30
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 a pull request may close this issue.

1 participant