#!/bin/bash # # Auto check and mount backup NFS in PRO-Admin infrastructure # # NFS share details nfs_server="192.168.0.134" nfs_share="/XXX" mount_point="/XXX/" # Check if the NFS share is already mounted mount | grep -q "$nfs_server:$nfs_share" if [ $? -eq 0 ]; then echo "NFS share is already mounted." else # Attempt to mount the NFS share mount -t nfs "$nfs_server:$nfs_share" "$mount_point" if [ $? -eq 0 ]; then echo "NFS share mounted successfully." else # Mount failed, send push notification using Pushover API pushover_token="aiSG2dcPxQDxTZhW6yr3yTh4tAc32d" pushover_user="ugghFSegB68uNpKy8RxHnVEjA4g3ZF" message="!! OTT PROBLEM !!/ serwer nextcloud, udzial: $nfs_server:$nfs_share" curl -s \ --form-string "token=$pushover_token" \ --form-string "user=$pushover_user" \ --form-string "message=$message" \ https://api.pushover.net/1/messages.json echo "Failed to mount NFS share. Push notification sent." fi fi