run_before_grid_tile.sh Does not seem to be working as expected.
Setting gdalenv manually is needed to run the script. grid_tile.sh should probably be rewritten completely, it is not very robust and requires a lot of tweaking and source editing for simple things as chaneging path of the temp file.