[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Howto check user
From: |
Brendan Strejcek |
Subject: |
Re: Howto check user |
Date: |
Wed, 7 Jul 2004 10:09:57 -0500 |
User-agent: |
Mutt/1.3.28i |
Sigurd Trygg wrote:
> Using cfengine 2.1, what is the most convenient way to check if a user
> exists on a system?
classes: user_exists = ( ReturnsZero(/usr/bin/id someuser) )
That generates some extraneous output though...
The following works better:
#!/usr/sbin/cfagent -qKf
classes:
asdf_exists = ( ReturnsZero(/bin/sh -c '/usr/bin/id asdf >/dev/null 2>&1') )
root_exists = ( ReturnsZero(/bin/sh -c '/usr/bin/id root >/dev/null 2>&1') )
control:
actionsequence = ( shellcommands )
shellcommands:
asdf_exists:: "/bin/echo asdf exists"
root_exists:: "/bin/echo root exists"