(An OSM contributer (kfj) reported this to me):
I ran osm2postgresql, and at the point when the call to osmosis happens, the process would fail with a lot of lengthy error messages (in the log file). I tried the isolated osmosis call with modified parameters, and found that leaving out nodeLocationStoreType="TempFile" made the problem go away. So without this parameter, the osmosis default is used, and that runs just fine.
Any reason you use this parameter? When I tried it, my system would produce heavy disk activity for about a minute and then fail saying that the read-xml task had failed.
I'm using Kubuntu 11.4 on a 32bit intel system.
I also think it might be a nice addition to your script if you let it output some messages as well - even if it's only a little message saying if it has succeeded or failed.
So now I can finally put OSM data as a postgis layer on top of the contours I've made