Provided by: eta_1.0.1-1_amd64
NAME
eta - calculate eta of a running process by repeatedly inspecting its progress
SYNOPSIS
eta [OPTIONS] TARGET PROGRESS_COMMAND
DESCRIPTION
eta prints the progress and estimated time to completion based on the given PROGRESS_COMMAND and TARGET value. PROGRESS_COMMAND should be a command that prints the current progress of some running process. If, for example, the running process is a file copy, a suitable progress command would be du -b some.file TARGET should be the target value (value representing 100%) for the progress command. For a file copy the target value should be the size of the source file. If you have for example the following process running: scp -r dir/ myserver: you could monitor its progress and eta using eta "$(du -bs dir)" ssh myserver du -bs dir It's similar to watch(1) in the sense that it executes the given command repeatedly, but instead of displaying the output of the command, it parses the output and displays the progress and eta. See NOTES for further details.
OPTIONS
Options adjust the behavior and output of eta. -s, --start VALUE|initial Use VALUE as the starting value for the process (the value representing 0% progress). If you are, for example, appending a 1GB file onto an existing 1GB file… cat new_1GB >> existing_1GB …you use… eta --start 1G 2G du -b existing_1GB …to avoid having the progress start at 50%. If you use initial the first value returned by the progress command will be used as start value. This could be useful if you don't know the original start value, or if you're only interested in the progress of the remaining process. The default starting value is 0. -i, --interval SECS Run the progress command every SECS seconds. (May not be used in conjunction with --cont.) -d, --down To be used when the value decreases during progress. For example, if a script processes files in a directory and removes them as they get processed, you could use the following to monitor the progress: eta --down 0 "ls | wc -l" Since the starting value will rarely be 0 when using --down the default for --start is changed to initial. -w, --width COLS Specifies the width of the output of eta. If this option is not provided, the output will fill the width of the terminal, or, default to 80 columns if there's no TTY. -c, --cont Instead of running the given command repeatedly, eta will let the command keep running, and read the progress continuously line by line. If the process to be monitored writes its progress to a log file, you could for example use something like eta --cont 100 "tail -n1 -f program.log | grep Progress:" (May not be used in conjunction with --interval.) -h, --help Prints a help message and exits.
EXAMPLES
Copying files If you're copying a directory to a remote host using something like scp -r dir/ server: you can monitor the progress using eta -i 10 "$(du -bs dir)" ssh server du -bs dir Growing number of files If you're processing lots of files using something like mogrify -resize 50% -path output-dir *.jpg (Resize all jpg images and store the smaller versions in output-dir.) You can use eta $(ls *.jpg | wc -l) "ls output-dir/*.jpg | wc -l" Note that the number of files may reach the target value before the last file is fully processed. Shrinking number of files If you're processing files and removing them as they get processed… for f in *; do ./process.sh $f && rm $f; done …you can monitor the progress using: eta --down 0 "$(ls | wc -l)" Counting lines You can use --cont and cat -n to continuously monitor progress based on number of lines printed: tar vcfz bkp.tgz dir/ | eta --cont $(find dir/ | wc -l) cat -n The process prints progress in a log file If your running process logs the progress to a file, you could do something like eta --cont 100 "tail -n1 -f program.log | grep Progress:" The process prints progress on stdout If you have a process that prints its progress on stdout: $ ./my-script.sh Progress: 1 out of 55... Progress: 2 out of 55... Progress: 3 out of 55... … you can use --cont and the command itself as argument to eta: eta --cont 55 ./my-script.sh or, if you're a UUOC fan: ./my-script.sh | eta --cont 55 cat
EXIT STATUS
0 Command completed successfully 1 Invalid command line arguments 2 Execution of external command failed 3 Could not find a number indicating progress in command output
NOTES
When parsing the TARGET value and --start argument, eta will look for the first digit and start parsing from there. The given values may have a suffix indicating a metric or binary magnitude. Supported suffixes are k, m, g, t, ki, mi, gi and ti (representing 10^3, 10^6, 10^9, 10^12, 2^10, 2^20, 2^30 and 2^40 resp.) All arguments following the TARGET value will be joined and used as the PROGRESS_COMMAND. That is, there's no need for double quotes here: eta 5g du -b bigfile If stdout is a file or pipe, eta will print a new line between each progress output, instead of a carriage return. If you want the new line behavior in the terminal, simply pipe the output through cat(1). eta will only look for the progress value in the first 1000 characters of the first line of output written by the progress command (unless --cont is provided).
AUTHOR
Written by Andreas Lundblad (andreas.lundblad@gmail.com).
REPORTING BUGS
Report bugs in the issue tracker at github: <https://github.com/aioobe/eta/issues>
SEE ALSO
watch(1), pv(1), progress(1)