Run the broker

After you have created your configuration file, start the Helix Broker from the command line by issuing the following command:

p4broker -c config_file

Alternatively, you can set P4BROKEROPTIONS before launching the broker and use it to specify the broker configuration file (or other options) to use.

For example, on Unix:

export P4BROKEROPTIONS="-c /usr/perforce/broker.conf"p4broker -d

and on Windows:

C:\> p4 set -s P4BROKEROPTIONS="-c c:\p4broker\broker.conf"
C:\> p4broker

The Helix Broker reads the specified broker configuration file, and on Unix platforms the -d option causes the Helix Broker to detach itself from the controlling terminal and run in the background.

To configure the Helix Broker to start automatically, create a startup script that sets P4BROKEROPTIONS and runs the appropriate p4broker command.

On Windows systems, you can also set P4BROKEROPTIONS and run the broker as a service. This involves the following steps:

C:\> cd C:\p4broker\
C:\p4broker\> copy p4broker.exe p4brokers.exe
C:\p4broker\> copy "C:\Program Files\Perforce\Server\svcinst.exe" svcinst.exe
C:\p4broker\> svcinst create -n P4Broker -e "C:\p4broker\p4brokers.exe" -a
C:\p4broker\> p4 set -S P4Broker P4BROKEROPTIONS="-c C:\p4broker\p4broker.conf"
C:\p4broker\> svcinst start -n P4Broker

svcinst.exe is a standard Windows program. P4Broker is the name given to the Windows service. For more information, see the Perforce Knowledge Base article, Installing P4Broker on Windows and Unix systems.