]> git.donarmstrong.com Git - uiuc_igb_scripts.git/commitdiff
support precommands before running scripts
authorDon Armstrong <don@donarmstrong.com>
Tue, 6 Jun 2017 19:03:58 +0000 (12:03 -0700)
committerDon Armstrong <don@donarmstrong.com>
Tue, 6 Jun 2017 19:03:58 +0000 (12:03 -0700)
dqsub

diff --git a/dqsub b/dqsub
index 8620f1f9856e1d41814f776296b293f1f8646b02..e2b6e760fa626b31e99cd6a51fc003e5afa70ed9 100755 (executable)
--- a/dqsub
+++ b/dqsub
@@ -34,6 +34,7 @@ dqsub [options]
    --account, -A Account name to use
    --join, -J join error and output streams (default)
    --name, -N Name of the job
+   --precommand Optional command to run before each command
    --debug, -d debugging level (Default 0)
    --help, -h display this help
    --man, -m display manual
@@ -131,6 +132,7 @@ GetOptions(\%options,
            'pmem|process_mem|process-mem=s',
            'pvmem|process_virtual_mem|process-virtiual-mem=s',
            'max_file|max-file|file=s',
+           'precommand|pre-command|pre_command=s',
            'dir=s',
            'name=s',
            'debug|d+','help|h|?','man|m');
@@ -335,6 +337,14 @@ sub write_qsub_script {
         $script .= <<EOF;
 # this script was written by dqsub
 EOF
+    # if there is a precommand, write it out
+    if ($opt->{precommand}) {
+        $script .=<<EOF;
+# this is the precommand _BEGIN_
+$opt->{precommand}
+# precommand _END_
+EOF
+    }
     my $directory = getcwd;
     if (defined $opt->{dir}) {
         $directory = abs_path($opt->{dir});