logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

eta - calculate eta of a running process by repeatedly inspecting its progress

Author

       Written by Andreas Lundblad (andreas.lundblad@gmail.com).

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-bsome.fileTARGET 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-rdir/myserver:

       you could monitor its progress and eta using

              eta"$(du-bsdir)"sshmyserverdu-bsdir

       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.

Examples

Copyingfiles
       If you're copying a directory to a remote host using something like

              scp-rdir/server:

       you can monitor the progress using

              eta-i10"$(du-bsdir)"sshserverdu-bsdirGrowingnumberoffiles
       If you're processing lots of files using something like

              mogrify-resize50%-pathoutput-dir*.jpg

       (Resize all jpg images and store the smaller versions in output-dir.) You can use

              eta$(ls*.jpg|wc-l)"lsoutput-dir/*.jpg|wc-l"

       Note that the number of files may reach the target value before the last file is fully processed.

   Shrinkingnumberoffiles
       If you're processing files and removing them as they get processed…

              forfin*;do./process.sh$f&&rm$f;done

       …you can monitor the progress using:

              eta--down0"$(ls|wc-l)"Countinglines
       You can use --cont and cat-n to continuously monitor progress based on number of lines printed:

              tarvcfzbkp.tgzdir/|eta--cont$(finddir/|wc-l)cat-nTheprocessprintsprogressinalogfile
       If your running process logs the progress to a file, you could do something like

              eta--cont100"tail-n1-fprogram.log|grepProgress:"Theprocessprintsprogressonstdout
       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--cont55./my-script.sh

       or, if you're a UUOC fan:

              ./my-script.sh|eta--cont55cat

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

Name

       eta - calculate eta of a running process by repeatedly inspecting its progress

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:

              eta5gdu-bbigfile

       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).

Options

       Options adjust the behavior and output of eta.

       -s,--startVALUE|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…

              catnew_1GB>>existing_1GB

       …you use…

              eta--start1G2Gdu-bexisting_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,--intervalSECS
              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--down0"ls|wc-l"

       Since the starting value will rarely be 0 when using  --down  the  default  for  --start  is  changed  to
       initial.-w,--widthCOLS
              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--cont100"tail-n1-fprogram.log|grepProgress:"

       (May not be used in conjunction with --interval.)

       -h,--help
              Prints a help message and exits.

Reporting Bugs

       Report bugs in the issue tracker at github: <https://github.com/aioobe/eta/issues>

See Also

watch(1), pv(1), progress(1)

GNU                                             09 February 2019                                          ETA(1)

Synopsis

eta [OPTIONS] TARGETPROGRESS_COMMAND

See Also