also sprach Nigel Kersten <[email protected]> [2009.08.06.2128 +0200]:
> I see the problem.
> 
>     def enabled?
>         output = update "-n", "-f", @resource[:name], "remove"
> 
>         # If it's enabled, then it will print output showing removal of
>         # links.
>         if output =~ /etc\/rc[\dS].d\/S|not installed/
>             return :true
>         else
>             return :false
>         end
>     end

Ouch! Good spot.

> There must be a better way to do this...

invoke-rc.d --query cron start

This will return 104 if cron would be started in the current
runlevel, which means that the init.d script symlink exists for the
runlevel.

If it returns 101 or 106, then cron is disabled by policy (but the
init.d script exists).

If it returns 100, then the init.d script does not exist.

If it returns 105, then all bets are off.

man invoke-rc.d

-- 
 .''`.   martin f. krafft <[email protected]>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
 
"whale feces or working at microsoft? i would probably be the whale
 feces researcher. salt air and whale flatulence; what
 could go wrong?"
             -- michael moyer, executive editor of _popular science_

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

Reply via email to