media-remount-syncd 460 B

1234567891011121314
  1. #!/bin/sh
  2. findmnt --noheadings --pairs --output target,options --poll=mount \
  3. | while read line; do
  4. # TARGET="..." OPTIONS="..."
  5. eval $line
  6. # NOTE: ignores mounts that were explicitly mounted with async
  7. if case "$TARGET" in /media/*) true;; *) false;; esac \
  8. && case "$OPTIONS" in *sync*) false;; *) true;; esac; then
  9. echo "mount -o remount,sync \"$TARGET\"" 1>&2
  10. mount --verbose -o remount,sync "$TARGET" 1>&2
  11. fi
  12. done