Hi,
On Thu, Oct 11, 2007 at 04:43:23AM -0400, Paul Davis wrote:
quoted text > On Thu, 2007-10-11 at 11:52 +0700, Patrick Shirkey wrote:
> > On Wed, 2007-10-10 at 06:37 -0400, Forest Bond wrote:
> > > Hi,
> > >=20
> > > On Wed, Oct 10, 2007 at 09:51:35AM +0700, Patrick Shirkey wrote:
> > > > On Tue, 2007-10-09 at 09:16 -0400, Forest Bond wrote:
> > > > > On Tue, Oct 09, 2007 at 01:11:38PM +0200, Lars Luthman wrote:
> > > > > > Slightly-slower-hack: add the 'sync' option to whatever script =
or config
quoted text > > > > > > file is used to mount the device (/etc/fstab, udev rules, KDE s=
ervice
quoted text > > > > > > menu etc). That way all writes will be synchronised automatical=
ly.
quoted text > > > > >=20
> > > > > It sounds like this doesn't matter much for you, but keep in mind=
that -o
quoted text > > > > > sync doesn't cause reads to be unbuffered, so don't go trying to =
benchmark
quoted text > > > > > your flash devices that way!
> > > >=20
> > > > Hmm, I need speed and accuracy.=20
> > >=20
> > > But only for writes, no?
> >=20
> > For the purpose of this script I am happy with just write but I will be
> > needing read in the near future.
> >=20
> > FYI, I can connect 200 usb-storage devices to a dual cpu intel with 4 GB
> > RAM and an extra pci-usb card on the same irq as the internal usb bus.=
=20
quoted text > >=20
> > Basically I am uploading content to a couple of hundred mp3/multi media
> > players at the same time and this script is used by other people with
> > less Linux knowledge than I so I'm trying to make the progress bar as
> > accurate as possible. Otherwise there is a significant lag between when
> > the progress bar says it is finished to when the transfer is actually
> > finished. Speed is also a major issue here so I cannot use the sync
> > option as that causes way too much delay compared to async.
> >=20
> > Can anyone here shed a little more light on how to monitor the disk
> > activity while transferring data?
>=20
> if you use your own compiled code for the copy, you can open the
> destination files with O_SYNC. from man 2 open:
>=20
> O_SYNC The file is opened for synchronous I/O. Any write()s on
> the resulting file descriptor will block the calling proc=
ess
quoted text > until the data has been physically written to the underlying
> hardware. See RESTRICTIONS below, though.
>=20
> this avoids having the entire mount be done with the sync option.
Or, use Python instead of bash...
Python gets you a full POSIX interface, and you can work a shell from within
Python (when you need it).
Alternatively, you could whip up a very small Python/C/whatever program tha=
t you
could call from your shell script. It could even print the percentages to
stdout or stderr, making your shell script's life easier:
$ copy-sync source dest
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
-Forest
--=20
Forest Bond
http://www.alittletooquiet.net