stroess Posted March 1, 2020 Posted March 1, 2020 Just a minor problem: uptime from procps-nf 3.3.15 (Armbian buster) - as used in 30-armbian-sysinfo to get uptime/logged-in users/load - generates different outputs if the uptime is either less or more than 1 day or less than 1 hour ("hh:mm" or "d days, hh:mm" or "nn min") - this gets the 30-armbian-sysinfo confused on gathering the logged-in user count resp. load. I suggest the below fix: ... # get uptime, logged in users and load # fix for uptime from procps-ng 3.3.15: reports uptime less then a day as "hh:mm," # but uptime larger than a day as "nn days, hh:mm," or "nn days, mm min", and less than 1 hour as "mm min," # which mixes up the assignments for user count and load in the original script # due to the various differing uptime value formats we'll cut out the components for uptime / user(s) / load # by bash string substitutions UPTIME=$(uptime) UPT1=${UPTIME#*'up '} #cut off begin of uptime string to string 'up' to remove time of day UPT2=${UPT1%'user'*} #cut off previous string to string 'user' to remove anything after and including string 'user' users=${UPT2//*','} #cut off previous string until last ',' if any to collect user(s) count users=${users//' '} #strip off blanks time=${UPT2%','*} #cut off last ',' and user count to collect any uptime time format time=${time//','} #get rid of any ',' if any load=${UPTIME#*'load average: '} # cut off everything before and including string 'load average: ' load=${load//','} #get rid of ',' separating the 1 - 5 - 15 load values #echo "debug UPT1=|$UPT1| UPT2=|$UPT2| users=|$users| time=|$time| load=|$load|" ... Also I suggest to allow bonding to be recognized for the IP address display by replacing the SHOW_IP_PATTERN with SHOW_IP_PATTERN="^bond*|^[ewr].*|^br.*|^lt.*|^umts.*" Regards - Rob (environment: Cubietruck / Armbian Buster 10.3 / Linux 5.4.20-sunxi) P.S. A big THX for the good work on Armbian to Igor and the other contributors !!!
Igor Posted March 1, 2020 Posted March 1, 2020 3 hours ago, stroess said: A big THX for the good work on Armbian to Igor and the other contributors !!! Thank you! BTW. Perhaps open a PR to the build engine, files are here: https://github.com/armbian/build/tree/master/packages/bsp/common/etc/update-motd.d
stroess Posted March 1, 2020 Author Posted March 1, 2020 You're welcome, Igor. My above post has been updated to provide a solution now for all 3 uptime format cases ("hh:mm," and "nn days, hh:mm," and "mm min,"). I tried opening a PR to the build engine you suggested .. but I'm very unsure on how to proceed .. so if you don't mind I'd rather shy away from messing up anything, and kindly ask you to add the two changes (uptime / bonding IP) provided above. Cheers - Rob
Igor Posted March 2, 2020 Posted March 2, 2020 By copy pasting, I get: Buster: System load: 0.23 0.09 0.03 Up time: 48 days 19:44 hour(s) Local users: 2 Memory usage: 23 % of 2015MB Zram usage: 36 % of 1007Mb IP: 10.0.10.36 CPU temp: 50°C Usage of /: 15% of 7.2G storage/: 100% of 234G 16:10:19 up 48 days, 19:45, 2 users, load average: 0.17, 0.09, 0.03 Bionic: error in 30-armbian-sysinfo: unexpected uptime format: received UPTIME= 16:10:51 up 1 day, 5 min, 1 user, load average: 0.08, 0.03, 0.01 Up time: Memory usage: 4 % of 1993MB IP: 10.0.10.166 CPU temp: 40°C Usage of /: 4% of 30G 16:11:07 up 1 day, 5 min, 2 users, load average: 0.06, 0.03, 0.00 On 3/1/2020 at 4:09 PM, stroess said: shy away from messing up anything You can only edit your fork and can't mess up anything. Trust me, its more convenient to fix the code / collaborate via Git / Github.https://docs.armbian.com/Process_Contribute/#collaborate-on-the-project And it can become addictive
stroess Posted March 2, 2020 Author Posted March 2, 2020 oh dear, yet another uptime string format I wasn't aware of ... sigh to fix the script for handling *any* variants of combinations of less / greater than days / hours / minutes of uptime, I've changed (and btw simplified) the script .. see above edited original post. PR was made now for both uptime/users/load and bonding devices IP ... I see the PR in my branch of my repository, and from my understanding of the documentation I assumed this PR would subsequently automatically be generated also in the main repo .. but it is not visible there, afaik :-O Thx for the feedback Cheers [and quoting Alan B. Shepard's prayer on my newbie's attempt with GitHub :-) ] - Rob
Heisath Posted March 3, 2020 Posted March 3, 2020 No it does not get mirrored automatically. What you did is create a PR from your robstroess-patch-1_bond-uptime branch to your master branch. What you need to do is go here: https://github.com/armbian/build/pulls And create a PR from your robstroess-patch-1_bond-uptime branch to our master. So robstroess:robstroess-patch-1_bond-uptime to armbian:master. Hope this helps, don't give up, Github is one complicated beast but Igor is right, once you know it a bit it is really helpful. For reference: Robs PR: https://github.com/robstroess/build/pull/1 Cheers Count-Doku
stroess Posted March 3, 2020 Author Posted March 3, 2020 Got it ... thanks for your kind help . Regards - Rob
Recommended Posts