Code for auto running on SGE