can i delete a shell script after it has been submitted using qsub without affecting the job?
Asked Answered
S

2

6

I want to submit a a bunch of jobs using qsub - the jobs are all very similar. I have a script that has a loop, and in each instance it rewrites over a file tmpjob.sh and then does qsub tmpjob.sh . Before the job has had a chance to run, the tmpjob.sh may have been overwritten by the next instance of the loop. Is another copy of tmpjob.sh stored while the job is waiting to run? Or do I need to be careful not to change tmpjob.sh before the job has begun?

Storer answered 6/2, 2012 at 22:0 Comment(0)
F
4

Assuming you're talking about torque, then yes; torque reads in the script at submission time. In fact the submission script need never exist as a file at all; as given as an example in the documentation for torque, you can pipe in commands to qsub (from the docs: cat pbs.cmd | qsub.)

But several other batch systems (SGE/OGE, PBS PRO) use qsub as a queue submission command, so you'll have to tell us what queuing system you're using to be sure.

Forman answered 6/2, 2012 at 22:19 Comment(1)
Thanks. The cluster uses an SGE scheduler.Storer
B
0

Yes. You can even create jobs and sub-jobs with HERE Documents. Below is an example of a test I was doing with a script initiated by a cron job:

#!/bin/env bash
printenv
qsub  -N testCron  -l nodes=1:vortex:compute -l walltime=1:00:00 <<QSUB
cd \$PBS_O_WORKDIR

printenv

qsub  -N testsubCron  -l nodes=1:vortex:compute -l walltime=1:00:00 <<QSUBNEST
cd \$PBS_O_WORKDIR
pwd
date -Isec

QSUBNEST


QSUB
Burst answered 6/1, 2018 at 5:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.