Environment block

An environment block defines environment variables that are applied to one or more services. You can have more than one environment block. Server-specific environment blocks settings override corresponding settings in global environment blocks.

An environment block is defined using the following syntax:

Environment
{
   variable = value
}

An environment block might be inside or outside of a server block.

  • If the block is outside a server block, the variables it contains are applied to the environment of all processes created by p4dctl.
  • If the block is inside a server block, the variables it defines are set only in the environment of that server’s processes, but they do override corresponding settings at the environment level.

For example, the following settings outside a server block ensure that:

  • logging is enabled

  • the server logging level is set to 1

  • the correct P4CONFIG files are used

  • the p4dctl MAINTENANCE script (introduced in the 2019.1 release) runs every night at 04:00. This is merely a checkpoint, not a complete backup solution.

Environment
{
    P4LOG = log
    P4DEBUG = "server=1" # Embedded = requires quotes
    P4CONFIG = .p4config
    MAINTENANCE = true
}
Note

Common settings can be placed into the /etc/perforce/p4dctl.conf configuration file.

  • The /etc/perforce/p4dctl.conf settings can be overridden by setting them in configuration files inside the P4DCTL directory. By default, /etc/perforce/p4dctl.conf.d is the directory for such configuration files.

  • Any configurables for a server that were made using p4 configure set or in the server spec override the P4DCTL settings.