Am Monday 26 July 2010 19:12:35 schrieb David Haller:
Hallo, ...
,----[ check_mountcount.sh ]
| #!/bin/sh | printf "%-10s %-8s %3s %4s %4s %s\n" \ | "device" "type" "max" "cur" "next" "mounted on" | echo "---------- -------- --- ---- ---- ----------···" | | rootfs=$(ls -l /dev/root 2>/dev/null | awk '{print $NF;}') | awk -v root="$rootfs" '/ext[23]/ { | if( $1 == "/dev/root" ) { $1 = root; } | print $1" "$2" "$3; | }' /proc/mounts | while \ | read -r device mntpt type | do | tune2fs -l "$device" \ | | | awk '/^Mount count/ { cur=$3; } | | /^Max.*mount count/ { max=$4; } | END { printf "%-10s %-8s %3s %4s %4s %s\n", | dev, t, max, cur, (max-cur), mnt; }' \ | dev="$device" mnt="$mntpt" t="$type" - | done ...> HTH, -dnh ...
Hallo David, da ich so etwas jetzt gebrauchen konnte, habe ich es aus Deiner Mail vom 26.7.10 ausgegraben. Da bei mir aber /dev/root nur auf md0 innerhalb von /dev verwies, musste ich es etwas erweitern um aus md0 /dev/md0 zu machen (die Zeile mit substr). Außerdem habe ich im Dateisystemtyp-Pattern die 4 für ext4 hinzugefügt. Da ich schreibfaul bin, habe ich es in chkmountcnt umbenannt. Jetzt sieht es so aus: ---- #!/bin/sh printf "%-10s %-8s %3s %4s %4s %s\n" \ "device" "type" "max" "cur" "next" "mounted on" echo "---------- -------- --- ---- ---- -------------" rootfs=$(ls -l /dev/root 2>/dev/null | awk '{print $NF;}') awk -v root="$rootfs" '/ext[234]/ { if( $1 == "/dev/root" ) { $1 = root; } if ($1 == root && substr(root, 0, 5) != "/dev/") { $1="/dev/" root; } print $1" "$2" "$3; }' /proc/mounts | while \ read -r device mntpt type do tune2fs -l "$device" \ | awk '/^Mount count/ { cur=$3; } /^Max.*mount count/ { max=$4; } END { printf "%-10s %-8s %3s %4s %4s %s\n", dev, t, max, cur, (max-cur), mnt; }' \ dev="$device" mnt="$mntpt" t="$type" - done --- Mal sehen, ob die KMail-Einstellung für feste Zeichenbreiten auch ordentlich ankommt. Deine Mail hatte ja auch feste Zeichenbreiten. Macht Skripte leserlicher. Tschö, Emil -- Registered Linux User since 19940320 -------------------------------------------------- Emil Stephan, Marktplatz 39, 53773 Hennef, Germany voice: +49-2242-84438 Accelerate Windows: 9.81 m/sec^2 would be adequate -- Um die Liste abzubestellen, schicken Sie eine Mail an: opensuse-de+unsubscribe@opensuse.org Um eine Liste aller verfuegbaren Kommandos zu bekommen, schicken Sie eine Mail an: opensuse-de+help@opensuse.org