Created attachment 148290 [details] Return an error if service is not enabled. Currently the rc service returns success when testing any function and it's not enabled. # in rc.conf ntpd_enable=NO # or unset # in a sample script if /etc/rc.d/ntpd status >/dev/null 2>&1; then # ntpd is running but we changed it's config, lets restart it for the new one /etc/rc.d/ntpd restart fi
rc is returning 0 because rc is not failing. This is one of the possible outputs considered by the rc script and it is not an error. Compare that with this piece of code in which a force start is issued but somehow (the script doesn't know why), it fails: if ! /etc/rc.d/${_depend} forcestart; then warn "Unable to force ${_depend}. It may already be running." return 1 fi