1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#! /bin/bash PROC=`ps | grep chronyd | grep -v grep`; if [ -n "$PROC" ]; then RESULT=`chronyc << ___EOF password opensesame online ___EOF` RESULT2=`echo $RESULT | grep OK` if [ -n "$RESULT2" ]; then echo 1 else echo 0; fi else echo -1; fi