My bad, I was not consistent in using the long options here. Please change it to this
`#!/var/cfengine/bin/cf-agent --no-lock`
This full path is required for the shebang to work so the above statement about using just cf-agent instead of the full path does not apply.

It also needs fixed in the example itself just below