Previous: Status Mode, Up: Genfile


D.3 Exec Mode

This mode is designed for testing the behavior of paxutils commands when some of the files change during archiving. It is an experimental mode.

The ‘Exec Mode’ is toggled by --run command line option (or its alias -r). The argument to this option gives the command line to be executed. The actual command line is constructed by inserting --checkpoint option between the command name and its first argument (if any). Due to this, the argument to --run may not use traditional tar option syntax, i.e. the following is wrong:

     # Wrong!
     genfile --run 'tar cf foo bar'

Use the following syntax instead:

     genfile --run 'tar -cf foo bar'

The rest of command line after --run or its equivalent specifies checkpoint values and actions to be executed upon reaching them. Checkpoint values are introduced with --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 Date input formats).
--exec command
Execute given shell command.

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.

Genfile exits with the exit status of the executed command.