I like to escape to the shell using \write18 at the very end of the compilation after the PDF file got completely written and was closed, so that I can use it as part the shell command. Is this somehow possible or does TeX simply closed the PDF at the very last thing? Placing it direct before \end{document} or in \AtEndDocument doesn't help (unsurprisingly).
AFAIK \writes are actually whatsit objects and would be normally be part of the document. So I don't have much hopes.
Background
This is used for automatic PDF-to-PNG conversion as a new feature of standalone. At the moment I do this in the preamble in the second run when the old PDF did not yet got opened. This works fine, but I would like to avoid the need to compile standalone diagrams twice.
write18in the preamble a shell command that "waits until compilation ends and then does something"? That would be a way around it? – Seamus Jul 13 '11 at 15:30$(pidof latex)? I can't remember exactly, but there's a way to get the pid of a process with a particular name... – Seamus Jul 13 '11 at 19:40latexprocesses. There could still be some around, e.g. when one is interrupted due to an error. Happens to me all the time. – Martin Scharrer Jul 13 '11 at 19:48luatex, the callbackstop_run(p.46 of the documentation) might help? – cjorssen Jan 19 '12 at 09:48