Run a qsub command from a parent folder to all dir

2019-08-29 04:16发布

I am using Redhat and a pbs queuing system to submit jobs to finite element analysis code. I typically have a folder that contains a .dat file, which is what I want to run, and a .pbs file that will submit the .dat file. To submit the .dat file I would run the command "qsub *.pbs" in the directory containing both files.

How could I submit or just run "qsub *.pbs" from outside of the directories containing the .dat files. I would typically be two directories up from the .dat files.

Thanks

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-29 04:44

You could do a find and exec

find /tmp/foo -name "*.pbs" -exec qsub {} \;

Here is a test that I ran

[spuder@moab tmp]$ mkdir /tmp/torqueFun
[spuder@moab tmp]$ cd !$
[spuder@moab torqueFun]$ touch foo.pbs
[spuder@moab torqueFun]$ touch bar.pbs
[spuder@moab torqueFun]$ touch foobar.pbs

[spuder@moab torqueFun]$ find . -name "*.pbs" -exec qsub {} \;
19185.moab.novalocal
19186.moab.novalocal
19187.moab.novalocal
查看更多
登录 后发表回答