#!/bin/bash
 ###     0            5       *       *        1-5     /usr/local/bin/CheckNTP-service.bash >/dev/null



ntppid=`cat /var/run/ntpd.pid`
### ntppid=""


if [[ $ntppid == "" ]] 
then
   echo "No NTPD running"     > /tmp/ntp.email.txt
   /sbin/service ntpd start  >> /tmp/ntp.email.txt 
   sleep 3
   /sbin/service ntpd status >> /tmp/ntp.email.txt
   mailx -s "NTP Restarted `hostname`" chouck@binghamton.edu < /tmp/ntp.email.txt
### else
###     echo "ntppid=\"$ntppid\"" > /tmp/ntp.email.txt
###     /sbin/service ntpd status >> /tmp/ntp.email.txt
###     mailx -s "NTP OK `hostname`" chouck@binghamton.edu < /tmp/ntp.email.txt
fi
