Pipe nohup output to logger w/ different priorities

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I've got a third-party Python script to run in background using nohup. And instead of piping the output to a file I'd like the output to be appended to the system log using logger. Added to that I need the error output to be logged using the priority "user.error" and the regular output "user.notice". This way I'm sure at least the errors pop up in the logs.



Running a simple command w/o nohup seems to work:



ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)


Running this /w nohup however yields unexpected results



nohup sh -c ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag) &


The log will contain "nohup: ignoring input" and sometimes even empty entries.



Can somebody help me to write this command properly ?







share|improve this question
























    up vote
    2
    down vote

    favorite












    I've got a third-party Python script to run in background using nohup. And instead of piping the output to a file I'd like the output to be appended to the system log using logger. Added to that I need the error output to be logged using the priority "user.error" and the regular output "user.notice". This way I'm sure at least the errors pop up in the logs.



    Running a simple command w/o nohup seems to work:



    ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)


    Running this /w nohup however yields unexpected results



    nohup sh -c ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag) &


    The log will contain "nohup: ignoring input" and sometimes even empty entries.



    Can somebody help me to write this command properly ?







    share|improve this question






















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I've got a third-party Python script to run in background using nohup. And instead of piping the output to a file I'd like the output to be appended to the system log using logger. Added to that I need the error output to be logged using the priority "user.error" and the regular output "user.notice". This way I'm sure at least the errors pop up in the logs.



      Running a simple command w/o nohup seems to work:



      ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)


      Running this /w nohup however yields unexpected results



      nohup sh -c ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag) &


      The log will contain "nohup: ignoring input" and sometimes even empty entries.



      Can somebody help me to write this command properly ?







      share|improve this question












      I've got a third-party Python script to run in background using nohup. And instead of piping the output to a file I'd like the output to be appended to the system log using logger. Added to that I need the error output to be logged using the priority "user.error" and the regular output "user.notice". This way I'm sure at least the errors pop up in the logs.



      Running a simple command w/o nohup seems to work:



      ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)


      Running this /w nohup however yields unexpected results



      nohup sh -c ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag) &


      The log will contain "nohup: ignoring input" and sometimes even empty entries.



      Can somebody help me to write this command properly ?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 '17 at 14:00









      Jan Goyvaerts

      1111




      1111




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          You're redirecting the output of nohup to logger. To redirect the output of ls (or your python script), you can use command substitution:



          nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &





          share|improve this answer




















          • Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token >' -sh: command substitution: line 80: ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
            – Jan Goyvaerts
            Nov 13 '17 at 13:05










          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f403758%2fpipe-nohup-output-to-logger-w-different-priorities%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          You're redirecting the output of nohup to logger. To redirect the output of ls (or your python script), you can use command substitution:



          nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &





          share|improve this answer




















          • Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token >' -sh: command substitution: line 80: ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
            – Jan Goyvaerts
            Nov 13 '17 at 13:05














          up vote
          0
          down vote













          You're redirecting the output of nohup to logger. To redirect the output of ls (or your python script), you can use command substitution:



          nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &





          share|improve this answer




















          • Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token >' -sh: command substitution: line 80: ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
            – Jan Goyvaerts
            Nov 13 '17 at 13:05












          up vote
          0
          down vote










          up vote
          0
          down vote









          You're redirecting the output of nohup to logger. To redirect the output of ls (or your python script), you can use command substitution:



          nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &





          share|improve this answer












          You're redirecting the output of nohup to logger. To redirect the output of ls (or your python script), you can use command substitution:



          nohup sh -c $(ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag)) &






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 '17 at 17:24









          cherdt

          6361415




          6361415











          • Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token >' -sh: command substitution: line 80: ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
            – Jan Goyvaerts
            Nov 13 '17 at 13:05
















          • Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token >' -sh: command substitution: line 80: ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
            – Jan Goyvaerts
            Nov 13 '17 at 13:05















          Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token >' -sh: command substitution: line 80: ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
          – Jan Goyvaerts
          Nov 13 '17 at 13:05




          Thanks ! It works for *Ubuntu. But on Busybox I'm getting the error "-sh: command substitution: line 80: syntax error near unexpected token >' -sh: command substitution: line 80: ls /tmp 1> >(logger --priority user.notice --tag myTag) 2> >(logger --priority user.error --tag myTag))'". Any idea ?
          – Jan Goyvaerts
          Nov 13 '17 at 13:05

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f403758%2fpipe-nohup-output-to-logger-w-different-priorities%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Christian Cage

          How to properly install USB display driver for Fresco Logic FL2000DX on Ubuntu?