Previous Table of Contents Index Next
Perforce 2009.2: Command Reference



p4 counter
Synopsis
Access, set, or delete a persistent variable.
Syntax
p4 [g-opts] counter countername
p4 [g-opts] counter countername value
p4 [g-opts] counter -d countername
p4 [g-opts] counter -f [ change|job|journal|monitor|security ] value
Description
Counters provide long-term variable storage for scripts that access Perforce. For example, the Perforce review daemon uses a counter (review) that stores the number of the last processed changelist.
When used in the form p4 counter countername, the value of variable countername is returned. When p4 counter countername value is used, the value of variable countername is set to value, and if countername does not already exist, it is created.
The Perforce server uses three counters in the course of its regular operations: change, job, and journal. Superusers can use the -f flag to force changes to these counters. Changes to these counters are not without risk; see the Release Notes for examples of the types of situations in which manually resetting these counters might be appropriate.
You can control server process monitoring by setting the monitor counter to 0 (disable monitoring), 1 (enable monitoring of active processes), or 2 (enable monitoring of both active and idle processes). You must stop and restart the Perforce server for any change in this counter to take effect. After you have enabled process monitoring, you can use p4 monitor to observe activity on the Perforce server.
To configure password strength requirements or to require the use of the ticket-based authentication mechanism, set the security counter to the desired level. You must stop and restart the Perforce server for this change to take effect. See the System Administrator's Guide for details.
Options
-d countername
Delete variable countername from the Perforce server.
Force a change to one of three internal counters used by Perforce. Most installations rarely, if ever, need to use this flag.
Server process monitoring off, monitor active processes only, or monitor both active and idle processes.
See p4 monitor for details.
See the System Administrator's Guide for details.
Usage Notes
Can File Arguments Use
Revision Specifier?
list to display a counter's value;
review to set a new value
super to use the -f flag
The last changelist number known to the Perforce server (the output of p4 counter change) includes pending changelists created by users, but not yet submitted to the depot. If you're writing change review daemons, you may also want to know the changelist number of the last submitted changelist, which is the second field of the output of the command:
p4 changes -m 1 -s submitted
Examples
Set the value of a counter mycounter to 123. If mycounter does not exist, it is created.
Requires review access.
Display the value of mycounter. If mycounter does not exist, its value is displayed as 0.
Requires list access.
Related Commands


Previous Table of Contents Index Next

Perforce 2009.2: Command Reference
Copyright 1999-2009 Perforce Software.