I would like to save the output of the uptime command into a csv file in a Bash script. Since the uptime command has different output formats based on the time since the last reboot I came up with a pretty heavy solution based on case, but there is surely a more elegant way of doing this.
I am working in an embedded device using a debian based distribution.
I'm monitoring the CPU load average using uptime command and atop.
Sometimes I see the uptime 1min average going up a lot (up to 4 in a single processor board, A LOT!) but in atop (with interval 1) I don't see the huge CPU usage that the uptime command suggest (I see something like: CPU sys 7% user 4% irq 1% idle 88%)