Previous Table of Contents Index Next
Perforce 2010.2: System Administrator's Guide

Appendix A
Invoke the Perforce server or perform checkpoint/journaling (system administration) tasks.
p4d [ options ]
p4d.exe [ options ]
p4s.exe [ options ]
p4d -j? [ -z ] [ args ... ]
The first three forms of the command invoke the Perforce background process ("Perforce server"). The fourth form of the command is used for system administration tasks involving checkpointing and journaling.
On UNIX and Mac OS X, the executable is p4d.
On Windows, the executable is p4d.exe (running as a server) or p4s.exe (running as a service).
Exit Status
After successful startup, p4d does not normally exit. It merely outputs the following 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 or journaling flags, p4d exits with a nonzero error code if any error occurs.
If you attempt to use Zeroconf and mDNS (multicast DNS) is not available, only the service registration fails. The error is logged in the server log, and the server continues with startup.
Run from inetd on UNIX
Run p4d.exe as a Windows service (equivalent to running p4s.exe).
Irreversibly reconfigure the Perforce server (and its metadata) to operate in Unicode mode. Do not use this flag unless you know you require Unicode mode. See the Release Notes and Internationalization Notes for details.
-A auditlog
Specify an audit log file. Overrides P4AUDIT setting. Default is null.
-Id description
A service description (optional) that will be advertised as a zero-configuration (Zeroconf) service. Use with -0. Overrides P4DESCRIPTION setting.
-In name
If Zeroconf is enabled with -0, this name will also be the name of the advertised zero-configuration service. Overrides P4NAME setting.
-J journal
Specify a journal file. Overrides P4JOURNAL setting. Default is journal. (Use -j off to disable journaling.)
-L log
Specify a log file. Overrides P4LOG setting. Default is stderr.
-p port
-r root
Specify the server root directory. Overrides P4ROOT. Default is current working directory.
-v subsystem=level
Set server trace flags. Overrides value P4DEBUG setting. Default is null.
-c command
Lock database tables, run command, unlock the tables, and exit.
-jc [ prefix ]
-jd file
-jj [ prefix ]
-jr file
Compress (in gzip format) checkpoints and journals.
-jrc file
Journal-restore with integrity-checking. Because this option locks the database, this option is intended only for use by replica servers started with the p4 replicate command.
-b bunch -jr file
Read bunch lines of journal records, sorting and removing duplicates before updating the database. The default is 5000, but can be set to 1 to force serial processing. This combination of flags is intended for use with by replica servers started with the p4 replicate command.
Ignore failures to delete records; this meaning of -f applies only when -jr is present. This combination of flags is intended for use with by replica servers started with the p4 replicate command.
Schedule new revisions for replica network transfer. Required only in environments that use p4 pull -u for archived files, but p4 replicate for metadata. Not required in replicated environments based solely on p4 pull.
Record restored journal records into regular journal. This combination of flags is intended for use in conjunction with Perforce technical support.
-t host:port
For replica servers, specify the target (master) server from which to pull data. Overrides P4TARGET setting. Default is null.
-u serviceuser
For replica servers, authenticate as the specified serviceuser when communicating with the master server. The service user must have a valid ticket before replica operations will succeed.
For replica servers, server will accept commands that read server metadata, but not write it. Overrides db.replication configurable.
For replica servers, a -D readonly server will accept commands that read depot files, but not write to them. A server running in -D none mode rejects any command that requires access to depot files. Overrides lbr.replication configurable.
Usage Notes
On all systems, journaling is enabled by default. If P4JOURNAL is unset when a server starts, the default location for the journal is $P4ROOT/journal. If you want to manually disable journaling, you must explicitly set P4JOURNAL to off.
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 use 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 can vary, depending on whether 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 of the filesystem containing P4ROOT, the journal is likely to remain accessible.
The database upgrade flag (-xu) can require considerable disk space. See the Release Notes for details when upgrading.
Zeroconf service registration requires support for mDNS (multicast DNS) and DNS-SD (DNS-based service discovery) on the server machine, such as Bonjour (for OS X), Bonjour for Windows (for Windows), or Avahi (for Linux or UNIX).
Related Commands
To start the server, listening to port 1999, with journaling enabled and written to journalfile.
To 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.
To create a compressed checkpoint from a server with files in directory P4ROOT
To create a compressed checkpoint with a user-specified prefix of "ckp" from a server with files in directory P4ROOT
To restore metadata from a checkpoint named checkpoint.3 for a server with root directory P4ROOT
To restore metadata from a compressed checkpoint named checkpoint.3.gz for a server with root directory P4ROOT
p4d -0 -In "Artists\' storage" -Id "Use this server for art assets"

Previous Table of Contents Index Next

Perforce 2010.2: System Administrator's Guide
Copyright 1997-2011 Perforce Software.