p4 bgtask
Run background commands or triggers on the server.
Syntax
p4 bgtask [-b -d -i -m -w] [-e -t ]
Description
Enables a superuser on the p4 command-line client to run commands or programs remotely on the server in the background.
The server saves output to the server log file.
To minimize memory consumption on the server, a long-running task should minimize its output to standard output and standard error.
The superuser defines the commands in the triggers table (with -t
) or as string arguments on the command line (with -e
). Supports setting startup commands, replication pull commands, for a specific serverId. The superuser can specify an interval for re-running the command.
Options
|
Maximum number of execution errors before ceasing to attempt execution. The default is 1. |
|
Detach the client, which means the client does not see the output of the server-side task execution. This is particularly useful for a task that runs for a long period of time. Tip
In detached mode, bgtask creates two separate pairs of log entries: 2017/10/04 14:20:35 pid 22735 user@ws0 127.0.0.1 [p4/2014.1.main/LINUX26X86_64/576838] 'user-cron -m 5 -d -i 1 -c perl foreground_detached.pl' 2017/10/04 14:21:35 pid 22735 completed .001s 0+0us 0+0io 0+0net 2140k 0pf 2017/10/04 14:20:35 pid 22735 user@ws0 background [p4/2014.1.main/LINUX26X86_64/576838] 'user-cron -m 5 -d -i 1 -c perl foreground_detached.pl' 2017/10/04 14:20:46 pid 22735 completed 10.1s 0+4us 0+8io 0+0net 2164k 0pf The first two lines record the start and end for the user portion of the command. The final two lines record the start and end for the background portion. |
|
Command string to execute. |
|
Seconds between command invocations. The default is 1 second. The maximum is 31 days. |
|
Maximum number of times the command is run. The default is 1. |
|
Name of the background trigger in the triggers table to execute. |
|
Seconds to pause after execution error before attempting the next execution. The default is 5. |
Usage Notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
N/A |
N/A |
|
Examples
|
Run a background task trigger immediately. |
|
Run the specified trigger every day. (A day has 86400 seconds.) |
|
Sample the server load. |
p4 bgtask -e "powershell -Command Import-Csv C:\p4root\errors.csv"
|
See the errors that have been logged. |