How to submit multiple commands as one liner in netbatch nbq commmand line












0















Can someone tell how to submit a one liner command using nbq command line?
Submitted multiple commands in Linux works fine but not in nbq mode as below.



find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn'" | sort -nr | head -n 50 | tee log


this works just find in Linux capturing the top 50 files in the check area.



nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn'" | sort -nr | head -n 50 | tee log


failed as it just executing the first part without recognizing the pipe.










share|improve this question
















bumped to the homepage by Community 14 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    Could you please add link to what nbq is [supposed to mean]?

    – user86969
    Jun 10 '16 at 7:25











  • nbq is the netbatch command to trigger netbatch job.

    – Grace
    Jun 10 '16 at 7:59






  • 1





    Both commands have a mis-matched " before the first pipe. Are those definitely what you're executing?

    – JigglyNaga
    Jun 10 '16 at 12:00
















0















Can someone tell how to submit a one liner command using nbq command line?
Submitted multiple commands in Linux works fine but not in nbq mode as below.



find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn'" | sort -nr | head -n 50 | tee log


this works just find in Linux capturing the top 50 files in the check area.



nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn'" | sort -nr | head -n 50 | tee log


failed as it just executing the first part without recognizing the pipe.










share|improve this question
















bumped to the homepage by Community 14 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 2





    Could you please add link to what nbq is [supposed to mean]?

    – user86969
    Jun 10 '16 at 7:25











  • nbq is the netbatch command to trigger netbatch job.

    – Grace
    Jun 10 '16 at 7:59






  • 1





    Both commands have a mis-matched " before the first pipe. Are those definitely what you're executing?

    – JigglyNaga
    Jun 10 '16 at 12:00














0












0








0








Can someone tell how to submit a one liner command using nbq command line?
Submitted multiple commands in Linux works fine but not in nbq mode as below.



find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn'" | sort -nr | head -n 50 | tee log


this works just find in Linux capturing the top 50 files in the check area.



nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn'" | sort -nr | head -n 50 | tee log


failed as it just executing the first part without recognizing the pipe.










share|improve this question
















Can someone tell how to submit a one liner command using nbq command line?
Submitted multiple commands in Linux works fine but not in nbq mode as below.



find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn'" | sort -nr | head -n 50 | tee log


this works just find in Linux capturing the top 50 files in the check area.



nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn'" | sort -nr | head -n 50 | tee log


failed as it just executing the first part without recognizing the pipe.







linux perl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 20 '18 at 7:22









Rui F Ribeiro

39.6k1479132




39.6k1479132










asked Jun 10 '16 at 7:14









user174414user174414

11




11





bumped to the homepage by Community 14 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 14 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 2





    Could you please add link to what nbq is [supposed to mean]?

    – user86969
    Jun 10 '16 at 7:25











  • nbq is the netbatch command to trigger netbatch job.

    – Grace
    Jun 10 '16 at 7:59






  • 1





    Both commands have a mis-matched " before the first pipe. Are those definitely what you're executing?

    – JigglyNaga
    Jun 10 '16 at 12:00














  • 2





    Could you please add link to what nbq is [supposed to mean]?

    – user86969
    Jun 10 '16 at 7:25











  • nbq is the netbatch command to trigger netbatch job.

    – Grace
    Jun 10 '16 at 7:59






  • 1





    Both commands have a mis-matched " before the first pipe. Are those definitely what you're executing?

    – JigglyNaga
    Jun 10 '16 at 12:00








2




2





Could you please add link to what nbq is [supposed to mean]?

– user86969
Jun 10 '16 at 7:25





Could you please add link to what nbq is [supposed to mean]?

– user86969
Jun 10 '16 at 7:25













nbq is the netbatch command to trigger netbatch job.

– Grace
Jun 10 '16 at 7:59





nbq is the netbatch command to trigger netbatch job.

– Grace
Jun 10 '16 at 7:59




1




1





Both commands have a mis-matched " before the first pipe. Are those definitely what you're executing?

– JigglyNaga
Jun 10 '16 at 12:00





Both commands have a mis-matched " before the first pipe. Are those definitely what you're executing?

– JigglyNaga
Jun 10 '16 at 12:00










1 Answer
1






active

oldest

votes


















0














When you run that whole nbq ... find ... | sort ..., pipeline, the shell splits the commands up as follows:



nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | 
sort -nr |
head -n 50 |
tee log


So the only thing that nbq sees is the bit before the first pipe. You need to stop the shell from doing that, and instead give the whole line to nbq. Without any documentation about how nbq parses and runs the command, it's difficult to know the right approach.





  • You could tell nbq to execute a shell sh, with your original one-liner as a single argument:



    nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
    sh -c "find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log"



  • Alternatively, nbq may be clever enough to manage the pipeline itself (or, more likely, start another shell to do the work), in which case you only need to escape each | to protect it from the (current) shell.



    nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
    find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log



  • If all else fails, you could abandon the "one-liner" approach, and put the whole pipeline in a script:



    #!/bin/sh
    find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' |
    sort -nr |
    head -n 50 |
    tee log


    then tell nbq to run that script instead:



    nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
    /path/to/top50.sh







share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f288891%2fhow-to-submit-multiple-commands-as-one-liner-in-netbatch-nbq-commmand-line%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    When you run that whole nbq ... find ... | sort ..., pipeline, the shell splits the commands up as follows:



    nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | 
    sort -nr |
    head -n 50 |
    tee log


    So the only thing that nbq sees is the bit before the first pipe. You need to stop the shell from doing that, and instead give the whole line to nbq. Without any documentation about how nbq parses and runs the command, it's difficult to know the right approach.





    • You could tell nbq to execute a shell sh, with your original one-liner as a single argument:



      nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
      sh -c "find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log"



    • Alternatively, nbq may be clever enough to manage the pipeline itself (or, more likely, start another shell to do the work), in which case you only need to escape each | to protect it from the (current) shell.



      nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
      find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log



    • If all else fails, you could abandon the "one-liner" approach, and put the whole pipeline in a script:



      #!/bin/sh
      find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' |
      sort -nr |
      head -n 50 |
      tee log


      then tell nbq to run that script instead:



      nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
      /path/to/top50.sh







    share|improve this answer




























      0














      When you run that whole nbq ... find ... | sort ..., pipeline, the shell splits the commands up as follows:



      nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | 
      sort -nr |
      head -n 50 |
      tee log


      So the only thing that nbq sees is the bit before the first pipe. You need to stop the shell from doing that, and instead give the whole line to nbq. Without any documentation about how nbq parses and runs the command, it's difficult to know the right approach.





      • You could tell nbq to execute a shell sh, with your original one-liner as a single argument:



        nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
        sh -c "find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log"



      • Alternatively, nbq may be clever enough to manage the pipeline itself (or, more likely, start another shell to do the work), in which case you only need to escape each | to protect it from the (current) shell.



        nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
        find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log



      • If all else fails, you could abandon the "one-liner" approach, and put the whole pipeline in a script:



        #!/bin/sh
        find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' |
        sort -nr |
        head -n 50 |
        tee log


        then tell nbq to run that script instead:



        nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
        /path/to/top50.sh







      share|improve this answer


























        0












        0








        0







        When you run that whole nbq ... find ... | sort ..., pipeline, the shell splits the commands up as follows:



        nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | 
        sort -nr |
        head -n 50 |
        tee log


        So the only thing that nbq sees is the bit before the first pipe. You need to stop the shell from doing that, and instead give the whole line to nbq. Without any documentation about how nbq parses and runs the command, it's difficult to know the right approach.





        • You could tell nbq to execute a shell sh, with your original one-liner as a single argument:



          nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
          sh -c "find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log"



        • Alternatively, nbq may be clever enough to manage the pipeline itself (or, more likely, start another shell to do the work), in which case you only need to escape each | to protect it from the (current) shell.



          nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
          find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log



        • If all else fails, you could abandon the "one-liner" approach, and put the whole pipeline in a script:



          #!/bin/sh
          find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' |
          sort -nr |
          head -n 50 |
          tee log


          then tell nbq to run that script instead:



          nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
          /path/to/top50.sh







        share|improve this answer













        When you run that whole nbq ... find ... | sort ..., pipeline, the shell splits the commands up as follows:



        nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | 
        sort -nr |
        head -n 50 |
        tee log


        So the only thing that nbq sees is the bit before the first pipe. You need to stop the shell from doing that, and instead give the whole line to nbq. Without any documentation about how nbq parses and runs the command, it's difficult to know the right approach.





        • You could tell nbq to execute a shell sh, with your original one-liner as a single argument:



          nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
          sh -c "find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log"



        • Alternatively, nbq may be clever enough to manage the pipeline itself (or, more likely, start another shell to do the work), in which case you only need to escape each | to protect it from the (current) shell.



          nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
          find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' | sort -nr | head -n 50 | tee log



        • If all else fails, you could abandon the "one-liner" approach, and put the whole pipeline in a script:



          #!/bin/sh
          find /nfs/disks/test_dir/ -name .snapshot -prune -o -printf '%s %pn' |
          sort -nr |
          head -n 50 |
          tee log


          then tell nbq to run that script instead:



          nbq -P <pool> -q <slot> -c <machine> -J <logfile> --task-name checkdisk 
          /path/to/top50.sh








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 10 '16 at 13:04









        JigglyNagaJigglyNaga

        3,873932




        3,873932






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f288891%2fhow-to-submit-multiple-commands-as-one-liner-in-netbatch-nbq-commmand-line%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Loup dans la culture

            How to solve the problem of ntp “Unable to contact time server” from KDE?

            ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux