Add more checl-scripts
This commit is contained in:
22
check_ntpd.sh
Executable file
22
check_ntpd.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user