Forum: Cfengine Help
Subject: Re: need help with restart_class; the example from the manual does not 
work (3.0.5p1)
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,18140,18144#msg-18144

The promise "ntpd" is very vague.  I would be more specific.  This is a regex.
# service ntpd start
Starting ntpd:                                             [  OK  ]
# ps -ef|grep ntpd
nwatson  31109 29804  0 08:42 pts/0    00:00:00 vim ntpd.cf
ntp      31403     1  0 08:44 ?        00:00:00 ntpd -u ntp:ntp -p 
/var/run/ntpd.pid -g
root     31406 31362  0 08:44 pts/0    00:00:00 grep ntpd

At the very least use "^ntpd", which I did using your test file.
cf3 *****************************************************************
cf3 BUNDLE check_ntpd_running
cf3 *****************************************************************
cf3 
cf3 
cf3      +  Private classes augmented:
cf3 
cf3      -  Private classes diminished:
cf3 
cf3 
cf3 
cf3    =========================================================
cf3    processes in bundle check_ntpd_running (1)
cf3    =========================================================
cf3 
cf3 Verifying SQL table promises is only available with Cfengine Nova or above
cf3 Observe process table with /bin/ps auxw
cf3 
cf3     .........................................................
cf3     Promise handle: 
cf3     Promise made by: ^ntpd
cf3     .........................................................
cf3 
cf3  -> Making a one-time restart promise for ^ntpd
cf3 
cf3    =========================================================
cf3    commands in bundle check_ntpd_running (1)
cf3    =========================================================
cf3 
cf3 Verifying SQL table promises is only available with Cfengine Nova or above
cf3  -> Promiser string contains a valid executable (/etc/init.d/ntpd) - ok
cf3 
cf3     .........................................................
cf3     Promise handle: 
cf3     Promise made by: /etc/init.d/ntpd start
cf3     .........................................................
cf3 
cf3  -> Executing '/etc/init.d/ntpd start' ...(timeout=-678,owner=-1,group=-1)
cf3  -> (Setting umask to 77)
cf3  !! Finished script /etc/init.d/ntpd start -- an error occurred
cf3 Q: "...nit.d/ntpd star": Starting ntpd:                
cf3 I: Last 1 QUOTed lines were generated by promiser "/etc/init.d/ntpd start"
cf3  -> Completed execution of /etc/init.d/ntpd start
cf3 
cf3      +  Private classes augmented:
cf3      +       start_ntpd
cf3 

I ran this as an unprivileged user so '/etc/init.d/ntpd start' was bound to 
fail.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to