[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

F.3 Exec Mode

This mode is designed for testing the behavior of paxutils commands when some of the files change during archiving. It supposes that the command being executed supports ‘--checkpoint’ and ‘--checkpoint-action’ options (see Checkpoints in GNU tar).

The ‘Exec Mode’ is enabled by ‘--run’ command line option (or its alias ‘-r’). The non-optional arguments supply the command line to be executed. Genfile modifies this command line by inserting the following options between the command name and first argument:

--checkpoint=n
--checkpoint-action "echo=genfile checkpoint %u"
--checkpoint-action "wait=SIGUSR1"

Here, n stands for the checkpoint granularity (for GNU tar, it is the number of archive records read or written between each pair of checkpoints). The default value is 1. This value can be changed using the optional argument to the ‘--run’ option. For example, to run actions on each 10th checkpoint:

genfile --run=10 ...

If the command line contains options, it must be preceded by a double-dash (‘--’), which will prevent these options from being interpreted by genfile itself. For example:

genfile --run --checkpoint=2 --truncate foo -- tar -c -f a.tar .

Notice also, that when running tar, its command line may not contain traditional options (cluster of letters without dash).

A set of options is provided for defining checkpoint values and actions to be executed upon reaching them. Checkpoint values are introduced with the ‘--checkpoint’ command line option. Argument to this option is the number of checkpoint in decimal.

Any number of actions may be specified after a checkpoint. Available actions are

--cut file
--truncate file

Truncate file to the size specified by previous ‘--length’ option (or 0, if it is not given).

--append file

Append data to file. The size of data and its pattern are given by previous ‘--length’ and ‘pattern’ options.

--touch file

Update the access and modification times of file. These timestamps are changed to the current time, unless ‘--date’ option was given, in which case they are changed to the specified time. Argument to ‘--date’ option is a date specification in an almost arbitrary format (see section Date input formats).

--exec command

Execute given shell command.

--delete file
--unlink file

Delete the named file or directory. If deleting the directory, it must be empty.

Option ‘--verbose’ instructs genfile to print on standard output notifications about checkpoints being executed and to verbosely describe exit status of the command.

While the command is being executed its standard output remains connected to descriptor 1. All messages it prints to file descriptor 2, except checkpoint notifications, are forwarded to standard error.

In exec mode, genfile exits with the exit status of the executed command.


[ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on March 24, 2021 using texi2html 5.0.