Skip to content

Instantly share code, notes, and snippets.

@atomtigerzoo
Created July 11, 2018 09:01
Show Gist options
  • Select an option

  • Save atomtigerzoo/8af351154ad62a8714fe52ce7a3f13c6 to your computer and use it in GitHub Desktop.

Select an option

Save atomtigerzoo/8af351154ad62a8714fe52ce7a3f13c6 to your computer and use it in GitHub Desktop.

Revisions

  1. atomtigerzoo created this gist Jul 11, 2018.
    21 changes: 21 additions & 0 deletions check-mount-point.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/bin/bash

    MOUNTPOINT="/some/mount-point"
    EMAIL="[email protected]"

    if cat /proc/mounts | grep ${MOUNTPOINT} > /dev/null; then
    echo "${MOUNTPOINT} already mounted."
    exit 0
    fi

    # If above did not exit
    mount ${MOUNTPOINT}

    if [ $? -eq 0 ]; then
    echo "${MOUNTPOINT} has been mounted."
    else
    # Mounting failed, send email
    echo "Mounting of ${MOUNTPOINT} failed." | mail -s "[server notification] Mount fail" $EMAIL
    fi

    exit