diff --git a/CIME/XML/env_batch.py b/CIME/XML/env_batch.py index aea6342b457..3417b58c3af 100644 --- a/CIME/XML/env_batch.py +++ b/CIME/XML/env_batch.py @@ -298,10 +298,14 @@ def make_batch_script(self, input_template, job, case, outfile=None): fd.write(output_text) # make sure batch script is exectuble - os.chmod( - output_name, - os.stat(output_name).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH, - ) + if not os.access(output_name, os.X_OK): + os.chmod( + output_name, + os.stat(output_name).st_mode + | stat.S_IXUSR + | stat.S_IXGRP + | stat.S_IXOTH, + ) def set_job_defaults(self, batch_jobs, case): if self._batchtype is None: