drive-exists.sh - ssh script by ActiveXperts Software
drive-exists.sh checks whether a drive exists.
Use drive-exists.sh directly from ActiveXperts Network Monitor; in the Manager's 'Monitor' menu, select 'New Check (Script)' and select drive-exists.sh. Configure the required parameter, or press 'Load a working sample'.
In ActiveXperts Network Monitor, Administrators can use three different scripting languages: Powershell, VBScript and SSH.
drive-exists.sh script code
################################################################################# # ActiveXperts Network Monitor - shell script checks # © 1999-2015, ActiveXperts Software B.V. # # For more information about ActiveXperts Network Monitor and SSH, please # visit the online ActiveXperts Network Monitor Shell Script Guidelines at: # http://www.activexperts.com/support/network-monitor/online/linux/ ################################################################################# # Script # drive-exists.sh # Description # Checks if a specified drive exists # Declare Parameters # 1) path (string) - Path to the disk to check # Usage # drive-exists.sh <path> # Sample # drive-exists.sh /dev/hda1 ################################################################################# #!/bin/sh # Validate number of arguments if [ $# -ne 1 ] ; then echo "UNCERTAIN: Invalid number of arguments - Usage: drive-exists <path>" exit 1 fi # Macro definitiions DISKS=`df -T | awk ' NR!=1 { if ($1=="'"$1"'") print "Y"; }'` # Check for the existance of the given partition if [[ -z $DISKS ]]; then echo "ERROR: Partition [$1] does not exist DATA:0" else echo "SUCCESS: Partition [$1] exists DATA:1" fi