You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
279 B

2 years ago
  1. #!/bin/bash
  2. HDDs=`cat /proc/diskstats | awk '/[sh][d][a-z] / {print$3}'`
  3. FIRST="1"
  4. JSON="{ \"data\":["
  5. for HDD in ${HDDs}; do
  6. if [ $FIRST == "0" ]; then
  7. JSON="${JSON},"
  8. fi
  9. JSON=${JSON}"{ \"{#HDD}\":\"${HDD}\"}"
  10. FIRST="0"
  11. done
  12. JSON=${JSON}"]}"
  13. echo ${JSON}

Powered by TurnKey Linux.