IDM Driver Status Script


I am working towards implementing IDM 4 into my environment. I found that on one of my servers, the driver had stopped without my knowledge. So I decided to write a bash script to check the status of the driver, restart it if needed, and email whenever the status of the driver changes.

Create the folder /var/opt/novell/scripts Copy the script into the directory, edit the variables as indicated in the script (#edit me comment) and set the permissions so it can be executed.

On line 7, that is a reminder note to add the ip address of your SMTP server to the /etc/mail.rc file so the script can send notifications...


admin="admin.tree" #edit me
password="secret" #edit me
dxml_driver="driver-name.context.tree" #edit me

#add "set smtp=smtp.ip.add.ress" to /etc/mail.rc file so the script can send email

email_to="" #edit me
email_body="/var/opt/novell/scripts/idm_driver_status.msg" #edit me

dxcmd_output=`/opt/novell/eDirectory/bin/dxcmd -user $admin -password $password -getstate $dxml_driver`
case $dxml_drvstate in
0) #stopped
echo -n "Driver state 0 - Stopped"
email_subj="IDM Driver $dxml_driver has STOPPED"
echo `! date` " - IDM Driver $dxml_driver status: Stopped... Attempting to restart driver $dxml_driver" >$email_body
dxcmd_output=`/opt/novell/eDirectory/bin/dxcmd -user $admin -password $password -start $dxml_driver`
/bin/mail -s "$email_subj" "$email_to" < $email_body
1) #starting
echo -n "Driver state 1 - Starting"
email_subj="IDM Driver $dxml_driver is STARTING"
echo `! date` " - IDM Driver $dxml_driver status: Starting... Please check the server" >$email_body
/bin/mail -s "$email_subj" "$email_to" < $email_body
2) #running
if grep -q -i running /var/opt/novell/scripts/idm_driver_status.msg
echo -n "No Change in Driver state 2 - Running"
echo ""
echo -n "Driver state 2 - Running"
email_subj="IDM Driver $dxml_driver is RUNNING"
echo `! date` " - IDM Driver $dxml_driver status: Running" >$email_body
/bin/mail -s "$email_subj" "$email_to" < $email_body
3) #stopping
echo -n "Driver state 3 - Stopping"
email_subj="IDM Driver $dxml_driver is STOPPING"
echo `! date` " - IDM Driver $dxml_driver status: Stopping... Please check the server" >$email_body
/bin/mail -s "$email_subj" "$email_to" < $email_body



How To-Best Practice
Comment List
Parents Comment Children
No Data
Related Discussions