[root@node01 init.d]# cat chrony
#!/bin/bash
case $1 in
start)
echo "################ Start #################"
su - root -c "systemctl start chronyd"
;;
stop)
echo "################ Stop #################"
su - root -c "systemctl stop chronyd"
;;
status)
if [ ` ps -ef | grep chronyd | grep -v grep | wc -l ` -eq 1 ];then
exit 0
else
exit 3
fi
;;
*)
echo "plz check" ;;
esac