Skip to content

envdir.8

Manvendra Bhangui edited this page Feb 25, 2024 · 3 revisions

NAME

envdir - runs another program with environment modified according to files in a specified directory.

SYNOPSIS

envdir [ -cwi ] d child

DESCRIPTION

d is a single argument. child consists of one or more arguments.

envdir sets various environment variables as specified by files in the directory named d. It then runs child.

If d contains a file named s whose first line is t, envdir removes an environment variable named s if one exists, and then adds an environment variable named s with value t. The name s must not contain =. Spaces and tabs at the end of t are removed. Nulls in t are changed to newlines in the environment variable. If the file s is completely empty (0 bytes long), envdir removes an environment variable named s if one exists, without adding a new variable. envdir reads a maximum of 256 bytes from s.

If envdir finds a directory named .envdir or a link named modifies environment variables according to files in .envdir. envdir avoids infinite recursive loops, by storing the inode number of directories visited and checking against the list. Any directory already processed is silently ignored. Files in .envdir are read first. This prevents environment variables in .envdir from overriding or deleting environment variables set in d.

if envdir finds a file named .envdir, it assumes that a file contains a list of additional directories to be processed for environment variables. Any directory included in this file which have been already processed are silently ignored.

if envdir finds a file or a symbolic link named .envfile, it assumes that a file contains envirnoment variables in key=value format. Comments, blank lines and leading white spaces are removed from the file. If it finds a line of the form s=t, envdir removes an environment variable named s if one exists, and then adds an evironment variable named s with value t. Whitespace at end of t are preserved and are part of the value. Nulls in t are changed to newlines in the environment variable. If envdir finds a line s, without =, envdir removes an environment variable named s if one exists, without adding a new variable.

Apart from .envdir and .envfile, envdir skips all files and directories starting with the '.' dot character.

In case of any error, envdir will not modify or add to the existing set of environment variables. In case of error, envdir will exit 111 without executing child unless the -w has been specified.

To see what environment variables are getting set by d, you can use the command

envdir -c d /usr/bin/env

OPTIONS

-c
This option clears all existing environment variables before modifying any environment variables.

-w
This option causes envdir to issue warnings on encountering errors instead of quitting before executing child.

-i
This option ignores if it cannot read a file in d. This allows the system administrator to specify different access to different users for any environment variable

EXIT CODES

envdir exits 111 if it has trouble reading d, if it runs out of memory for environment variables, or if it cannot run child. Otherwise its exit code is the same as that of child.

SEE ALSO

supervise(8), svc(8), svok(8), svstat(8), svscanboot(8), svscan(8), readproctitle(8), fghack(8), pgrphack(8), multilog(8), tai64n(8), tai64nlocal(8), setuidgid(8), envuidgid(8), softlimit(8), setlock(8),

Clone this wiki locally