Skip to content

Instantly share code, notes, and snippets.

@jezman
Created August 21, 2020 11:21
Show Gist options
  • Save jezman/91e516aa1cca0b23f0e44ba97261000d to your computer and use it in GitHub Desktop.
Save jezman/91e516aa1cca0b23f0e44ba97261000d to your computer and use it in GitHub Desktop.
Сhecking mounted resources by ip.
#!/bin/bash
grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" /etc/fstab | uniq | sort > mount_on_boot
df -h | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | uniq | sort > already_mounted
DIFF=$(diff mount_on_boot already_mounted)
if [ "$DIFF" != "" ]
then
logger "do something"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment