I have the following code

classes:
        host_groupa::
        usera        = ( ReturnsZero(/usr/bin/getent passwd usera) )


shellcommands:
        host_groupa.!usera::
        "/usr/sbin/useradd -g usera -d /export/home/usera -s /usr/local/bin/scponly 
-m -k /etc/skel usera"


So what that would do is evaluate a class usera if /usr/bin/getent passwd usera returns 0 if that user exists on the host. The disadvantage of this is that getent will provide output, which I don't want. I'm only interested in the return code. I want any of the output to go to /dev/null. So that is the first question. how can I take output from the command passed to ReturnsZero and send it to /dev/null?

The second question is: Does someone know of an easier way of testing for the existence of a user that wouldn't require a call to getent? Just wondering if there is a better solution out there.

Thanks,


Brian Seppanen
608.826.1464
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
http://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to