[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Trying to understand man page for dd



Hi,

Richard Owlett wrote:
> Am I correct that there is a problem with the man page?

Not with that example. It works as to be expected from the description.
The example in the coreutils manual gives a better motivation why one
would want to send USR1 signals to the running dd process.


> The [example] script copies bytes until the second line is encountered.
> It outputs data and *STOPS DEAD*

That's because the second kill command sent the default signal TERM,
which other than USR1 causes dd to end.
Without the final
  kill $pid
the dd process would run in background until you shut down your computer.

If you send more USR1 by

  kill -USR1 $pid

before the TERM signal then you get more output lines with increasing
byte counts:

  106330856+0 records in
  106330856+0 records out
  54441398272 bytes (54 GB) copied, 21.859 s, 2.5 GB/s
  113139254+0 records in
  113139254+0 records out
  57927298048 bytes (58 GB) copied, 23.2586 s, 2.5 GB/s
  121925708+0 records in
  121925707+0 records out
  62425961984 bytes (62 GB) copied, 25.0622 s, 2.5 GB/s

That you get
  richard@stretch-2nd:~$
from the kill command line does not actually mean that the dd process
has ended (although it has in this special case). This is because of
the ampersand at the end of the dd command.

But the next shell command line after the end of the dd process should
report its demise before the commands in that line get executed:

  [1]+  Terminated              dd if=/dev/zero of=/dev/null


Further you may check by

  ps -ef | fgrep 'dd if=/dev/zero'

whether the process is still running. If so, you will see an output
line like

  thomas   12084  1716 99 17:06 pts/8    00:00:03 dd if=/dev/zero of=/dev/null

where 12084 is the process id number of the dd run.


Have a nice day :)

Thomas


Reply to: