-
-
Notifications
You must be signed in to change notification settings - Fork 3
ctrlenv.8
ctrlenv - fetch environment from a control file using a key match and run a program
ctrlenv [-c] -f filename [-e env] -a address child
ctrlenv(8) supports three formats for filename.
-
A plain text file without any extension.
-
A file with .cdb extension. This imples a cdb file created from the plain text file using cdb-database(8).
-
A file with .sql extension. This implies data to be in MySQL.
child consists of one or more arguments.
ctrlenv sets environment variable env according to the first matched line for address address in the file /etc/indimail/control/filename It then runs child.
The matched lines can be in two forms. In the first form, it could be assignment of multiple environment variables separated by comma.
addr:envar1=val,envar2=val,envar3=,envar4=val:
If the matched line contains a line starting wth addr, the entire portion of the line following addr separated by colon ":" is parsed for variable assignment statements and environment variables can be set or unset. env=val adds an environment variable named env with value val. env= unsets an environment variable named env, if it exists.
Here envar1, envar2, envar4 set to val and envar3 is unset.
In the second form, it could a value that is assigned to env passed on the command line with the -e option.
addr:val:
If the matched line contains a line starting wth addr whose first word following addr separated by colon ":" is val, ctrlenv removes an environment variable named env if one exists, and then adds an environment variable named env with value val.
if env does not exists, ctrlenv adds an environment variable named env with value t.
If no matched lines are found, ctrlenv runs child without modifying any environment variable.
if filename has a .cdb extension, ctrlenv will use cdb(3) to do a match. You can use cdb-database(8) to convert a file to cdd format.
if filename has a .sql extension, ctrlenv will use MySQL table to do a match. You can use sql-database(8) to convert a file to a table in MySQL.
if -c option is passed on the command line all existing environment variables will be cleared before running child.
ctrlenv exits 111 if it has trouble reading filename, 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.
cdb-database(8), sql-database(8), 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), cdb(3), http://cr.yp.to/daemontools.html