23 lines
510 B
Bash
Executable File
23 lines
510 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
## - Check if ntp service is running. (Re)start service, if
|
|
## - it is down.
|
|
## -
|
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
if ! ps ax | grep /usr/sbin/ntpd | grep -v grep > /dev/null ; then
|
|
|
|
echo -e "\n\tNTP Daemon is not running. so i'm going to (re)start the ntp service..\n"
|
|
|
|
/etc/init.d/ntp stop
|
|
|
|
kill -9 `cat /var/run/ntpd.pid 2>/dev/null` > /dev/null 2>&1
|
|
rm -f /var/run/ntpd.pid
|
|
|
|
## - Start ntp daemon
|
|
/etc/init.d/ntp start
|
|
fi
|
|
|
|
exit 0
|