getgid

Table of Contents

Prototype: getgid(groupname)

Return type: int

Description: Return the integer group id of the group groupname on this host.

If the named group does not exist, the function will fail and the variable will not be defined.

Arguments:

  • groupname: string, in the range: .*

Example:

body common control
{
      bundlesequence => { "example" };
}

bundle agent example
{
  vars:
    linux|solaris|hpux::
      "gid" int => getgid("root");
    freebsd|darwin|openbsd::
      "gid" int => getgid("wheel");
    aix::
      "gid" int => getgid("system");

  reports:
      "root's gid is $(gid)";
}

Output:

R: root's gid is 0

Notes: On Windows, which does not support group ids, the variable will not be defined.