Build precise queries to find exactly what you need
Press ESC to close
The output is like this: “System Uptime – up 16 Hours, 23, 2 users Minutes”
so, I added this line: “strminutes1=${strminutes%%,*}’ Minutes'”
this way the output, comes this way “System Uptime – up 5 Hours, 36 Minutes” or “System Uptime – up 10 days, 10 Hours, 49 Minutes”
Complete code: struptime=`uptime | awk ‘{print $2,$3,$4,$5}’` struptime1=${struptime%,} strdayshours=${struptime1%%:*}’ Hours, ‘ strminutes=${struptime1##*:} strminutes1=${strminutes%%,*}’ Minutes’
echo “System Uptime -” $strdayshours$strminutes1 exit 0
Thanks a lot!
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!