Perforce Server (p4d) Reference

 

Synopsis

Invoke the Perforce server or perform checkpoint/journaling (system administration) tasks.

Syntax

p4d [ options ]
p4d -j [ -z ] [ args ... ]

Exit Status

After successful startup, p4d does not normally exit. It merely outputs the startup message

    Perforce server starting...
and runs in the background.

On failed startup, p4d returns a nonzero error code.

Also, if invoked with any of the -j checkpointing and/or journaling flags, p4d exits with a nonzero error code if any error occurs.

Options

Flag Meaning
-d Run as a daemon (in the background)
-f Run as a single-threaded (non-forking) process
-i Run from inetd on UNIX
-q Run quietly (no startup messages)
-xu Run database upgrades and exit.
-jc [ prefix ] Journal-create; checkpoint and save/truncate journal.
-jd [ file ] Journal-checkpoint; create checkpoint without saving/truncating journal.
-jj [ prefix ] Journal-only; save and truncate journal without checkpointing.
-jr file Journal-restore; restore metadata from a checkpoint and/or journal file.
-z Compress (in gzip format) checkpoints and journals.
-h, -? Print help message.
-V Print server version.
-J journal Specify a journal file. Overrides P4JOURNAL setting. Default is journal.
-L log Specify a log file. Overrides P4LOG setting. Default is stderr.
-p port Specify a port to listen to. Overrides P4PORT. Default 1666.
-r root Specify the server root directory. Overrides P4ROOT. Default is current working directory.
-v debuglevel Set server trace flags. Overrides value P4DEBUG setting. Default is null.

Usage Notes

  • On Windows, journaling is enabled by default. UNIX installations must manually activate journaling by specifying it on the command line or through the P4JOURNAL variable.

  • Take checkpoints and truncate the journal often, preferably as part of your nightly backup process.

  • Checkpointing and journaling preserve only your Perforce metadata (data about your stored files). The stored files themselves (the files containing your source code) reside under P4ROOT and must be also be backed up as part of your regular backup procedure.

  • If your users are using triggers, don't use the -f (non-forking mode) flag; the Perforce server needs to be able to spawn copies of itself ("fork") in order to run trigger scripts.

  • After a hardware failure, the flags required for restoring your metadata from your checkpoint and journal files may vary, depending on whether or not data was corrupted.

  • Because restorations from backups involving loss of files under P4ROOT often require the journal file, we strongly recommend that the journal file reside on a separate filesystem from P4ROOT. This way, in the event of corruption the filesystem containing P4ROOT, the journal is likely to remain accessible.

  • The database upgrade flag (-xu) is may require considerable disk space. See the Release Notes and the section "Important Notes for 2001.1" on page 16 if upgrading to 2001.1 or later from a 2000.2 or earlier server.

Related Commands

p4d -d -p 1999 -J /opt/journalfile Start the server, listening to port 1999, with journaling enabled and written to journalfile.
p4d -jc -J /p4d/jfile
   or
P4JOURNAL=/p4d/jfile
export P4JOURNAL
p4d -jc -J
Checkpoint a server with a non-default journal file. The -J argument (or the environment variable P4JOURNAL) must match the journal file specified when the server was started.
p4d -r $P4ROOT -z -jc Create a compressed checkpoint from a server with files in directory P4ROOT
p4d -r $P4ROOT -z -jc ckp Create a compressed checkpoint with a user-specified prefix of "ckp" from a server with files in directory P4ROOT
p4d -r $P4ROOT -jr checkpoint.3 Restore metadata from a checkpoint named checkpoint.3 for a server with root directory P4ROOT
p4d -r $P4ROOT -z -jr checkpoint.3.gz Restore metadata from a compressed checkpoint named checkpoint.3.gz for a server with root directory P4ROOT