I have this command to connect the DB. ./ssgodbc.linux64 -d "dsn" -u "username" -p 'pswd' -v How can I write a shell script to generate a mail alert if there is no db connection.
Examine the return value of that command. Experiment what the value is when it does connect to database, and when it does not. For example something like this Code: #!/bin/bash set -x ./ssgodbc.linux64 -d "dsn" -u "username" -p 'pswd' -v echo $?; Then make a conditional statement that sends e-mail if value indicates command failed.