generate script for psrun