Environment block

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

An environment block is defined with the 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 globally 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 specific server’s processes, and they 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.

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

cron job

The p4dctl MAINTENANCE script (introduced in the 2019.1 release) runs a cron job every night at 04:00 if MAINTENANCE = true, which is the default. You can modify the crontab to change the time this runs to suit your environment.

If you disable the script by setting MAINTENANCE = false, ensure that you have another method for taking regular checkpoints.

Be aware that checkpoints are not a complete solution for Backup and recovery.

The crontab control file for the cron job is likely to be at:
/etc/crontab.d/p4-server
For versions of P4DCTL prior to 2025.1, the control file is likely to be at
/etc/crontab.d/helix-p4d

Settings location and overrides

  • /etc/perforce/p4dctl.conf is the default file for settings that are common to all servers defined for P4DCTL, and this file can also contain one or more server blocks, each of which contains settings specific to one server.

  • The p4dctl utility allows you to modularize your configuration into separate files or directories. Each filename.conf file can contain one or more server blocks, with each server block being specific to one server. For example, you might add the edge-servers.conf file into the /etc/perforce/p4dctl.conf.d directory.

  • Settings made with p4 configure set or within the DistributedConfig form field of the p4 server spec override any p4dtcl settings.