mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-07 15:15:06 -05:00
Equivalent to V1.19.99.1
This is a verbatim copy of the files at that stage of the repository that was built from the CVS import. It allows future development to see a bit of recent history, but without carrying around the baggage going back to 1997. If that is really required, git grafts can be used.
This commit is contained in:
100
contrib/ken_gillett_1
Normal file
100
contrib/ken_gillett_1
Normal file
@@ -0,0 +1,100 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# chronyd This shell script takes care of starting and stopping
|
||||
# chronyd (NTP daemon).
|
||||
#
|
||||
# chkconfig: 45 80 20
|
||||
# description: chronyd is the NTP daemon.
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# Source networking configuration.
|
||||
. /etc/sysconfig/network
|
||||
|
||||
# Check that networking is up.
|
||||
[ ${NETWORKING} = "no" ] && exit 0
|
||||
|
||||
PREDIR="/usr/local"
|
||||
CHRONYD=$PREDIR"/sbin/chronyd"
|
||||
CHRONYC=$PREDIR"/bin/chronyc"
|
||||
|
||||
[ -x $CHRONYD -a -x $CHRONYC -a -f /etc/chrony.conf ] || exit 0
|
||||
|
||||
dochrony() {
|
||||
if [ -z "$(pidofproc chronyd)" ]; then
|
||||
echo -e "\n\tchronyd not running\n\n"
|
||||
exit 2
|
||||
fi
|
||||
KEY=`awk '$1 == "commandkey" {print $2; exit}' /etc/chrony.conf`
|
||||
PASSWORD=`awk '$1 == '$KEY' {print $2; exit}' /etc/chrony/keys`
|
||||
|
||||
$CHRONYC <<- EOF
|
||||
password $PASSWORD
|
||||
$@
|
||||
quit
|
||||
EOF
|
||||
}
|
||||
|
||||
# make the first parameter' lower case
|
||||
set - `echo $1 | awk '{print tolower($1)}';shift;echo "$@"`
|
||||
|
||||
# Expand any shortcuts.
|
||||
case "$1" in
|
||||
on|1)
|
||||
set - "online"
|
||||
;;
|
||||
off|0)
|
||||
set - "offline"
|
||||
esac
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
# Start daemons.
|
||||
echo -n "Starting chronyd: "
|
||||
daemon $CHRONYD
|
||||
if [ $? -eq 0 ]; then
|
||||
echo $(pidofproc chronyd) > /var/run/chronyd.pid
|
||||
touch /var/lock/subsys/chronyd
|
||||
fi
|
||||
echo
|
||||
;;
|
||||
stop)
|
||||
# Stop daemons.
|
||||
echo -n "Shutting down chronyd: "
|
||||
killproc chronyd
|
||||
echo
|
||||
rm -f /var/lock/subsys/chronyd
|
||||
;;
|
||||
status)
|
||||
status chronyd
|
||||
;;
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f /var/lock/subsys/chronyd ]; then
|
||||
$0 stop
|
||||
$0 start
|
||||
fi
|
||||
;;
|
||||
"")
|
||||
echo "Usage: chronyd
|
||||
{start|stop|restart|reload|condrestart|status|[on|off]line etc}"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
accheck|cmdaccheck|clients|manual|rtcdata|sources|sourcestats|tracking|clients)
|
||||
dochrony "$@"
|
||||
;;
|
||||
*)
|
||||
echo -n "Chrony $1: "
|
||||
dochrony "$@" > /dev/null
|
||||
[ $? -eq 0 ] && echo_success || echo_failure
|
||||
echo
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user