user-exists.sh - ssh script by ActiveXperts Software
user-exists.sh checks whether a user account exists.
Use user-exists.sh directly from ActiveXperts Network Monitor; in the Manager's 'Monitor' menu, select 'New Check (Script)' and select user-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.
user-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 # user-exists.sh # Description # This script will check if a user account exists # Declare Parameters # 1) username (string) - Username to check # Usage # user-exists.sh <username> # Sample # user-exists.sh axuser ################################################################################# #!/bin/sh # Validate number of arguments if [ $# -ne 1 ] ; then echo "UNCERTAIN: Invalid number of arguments - Usage: user-exists <username>" exit 1 fi # Checks if the user exists if id -u $1 >/dev/null 2>&1; then echo "SUCCESS: User exists DATA:1" else echo "ERROR: User does not exist DATA:0" fi