quasi-[OT] Adobe Flash
Marko Vojinovic
vvmarko at gmail.com
Sat Oct 23 18:24:12 UTC 2010
On Saturday, October 23, 2010 18:46:52 Patrick O'Callaghan wrote:
> On Sat, 2010-10-23 at 10:15 -0700, suvayu ali wrote:
> > On 23 October 2010 10:10, Marko Vojinovic <vvmarko at gmail.com> wrote:
> > > As for the <pid>, my guess is that the process that opens the file for
> > > writing is the only one allowed to actually write to it, since
> > > otherwise one can get a race condition and data might get corrupted.
> > > Once that process dies, tail will die along with it, leaving a clean
> > > /tmp/flashfile.flv as a result. At least that is my theory. ;-)
> > >
> > > Now, all that is needed is that someone write a script and try it out.
> > > I am not very versatile with extracting <pid> and <file_id> and such
> > > stuff, but otherwise the script should be trivial. :-)
> >
> > You can try it with the shell function I posted earlier in the thread.
> > Putting your tail command instead of the cp should be a good test. ;)
>
> I did a quick test copying /dev/zero and it seems to work, i.e. tail
> copies the nulls as one would hope. Also the '--pid=' option works as
> advertised.
Right, so in that case this should be a winner script (or a draft at least):
dupe_flash ()
{
pid=$( ps -fu `whoami`| egrep 'libflashplayer\.so'| egrep -om 1 -E
'\<[0-9]+\>'| head -1 );
fid=$( lsof -p $pid | egrep '/tmp/Flash'| egrep -om 1 -E '\<[0-9]+[a-z]\>'| tr
-d 'a-z');
tail -f -q --bytes=1G --pid=${pid} /proc/${pid}/fd/${fid} > ~/flashfile.flv
}
I don't know if word wrapping might be a problem, there should be only three
lines inside { }.
Feel free to test it :-), and tell us the results. I can't myself, don't have
flash on this machine, need to wait until I get home.
The script should be run while flash is downloading the movie, and it should
end on its own once done.
Best, :-)
Marko
More information about the users
mailing list