Browse Source

Update syno_hdd_db.sh

Changed to avoid issue #2
pull/15/head
007revad 3 years ago
parent
commit
f844548879
  1. 6
      syno_hdd_db.sh

6
syno_hdd_db.sh

@ -71,7 +71,7 @@ done
# SATA drives sda, sdb etc # SATA drives sda, sdb etc
for drive in /dev/sd*; do for drive in /dev/sd*; do
if [[ $drive =~ /dev/sd[a-z]{1,3}$ ]]; then if [[ $drive =~ /dev/sd[a-z]{1,2}$ ]]; then
tmp=$(hdparm -i "$drive" | grep Model) tmp=$(hdparm -i "$drive" | grep Model)
hdmodel=$(printf %s "$tmp" | cut -d"," -f 1 | cut -d"=" -f 2) hdmodel=$(printf %s "$tmp" | cut -d"," -f 1 | cut -d"=" -f 2)
fwrev=$(printf %s "$tmp" | cut -d"," -f 2 | cut -d"=" -f 2) fwrev=$(printf %s "$tmp" | cut -d"," -f 2 | cut -d"=" -f 2)
@ -227,15 +227,11 @@ done
if [[ ${showedits,,} == "yes" ]]; then if [[ ${showedits,,} == "yes" ]]; then
lines=$(((db2Edits *12) +4)) lines=$(((db2Edits *12) +4))
if [[ $db1Edits -gt "0" ]]; then if [[ $db1Edits -gt "0" ]]; then
#echo -e "\nChanges to $(basename -- "$db1")"
echo -e "\nChanges to ${Cyan}$(basename -- "$db1")${Off}" echo -e "\nChanges to ${Cyan}$(basename -- "$db1")${Off}"
#jq . "$db1" # nice colorized json format but displays whole file
jq . "$db1" | tail -n "$lines" # show last 20 lines per edit jq . "$db1" | tail -n "$lines" # show last 20 lines per edit
fi fi
if [[ $db2Edits -gt "0" ]]; then if [[ $db2Edits -gt "0" ]]; then
#echo -e "\nChanges to $(basename -- "$db2")"
echo -e "\nChanges to ${Cyan}$(basename -- "$db2")${Off}" echo -e "\nChanges to ${Cyan}$(basename -- "$db2")${Off}"
#jq . "$db2" | tail -n $((db2Edits *16)) # show last 20 lines per edit
jq . "$db2" | tail -n "$lines" # show last 20 lines per edit jq . "$db2" | tail -n "$lines" # show last 20 lines per edit
fi fi
fi fi

Loading…
Cancel
Save