How to execute a program from terminal redirecting stdout and stderr to systemd's journal?Understand logging in LinuxOutput of a python script running as unit is out of order while shells seems unnafectedExecutable script can't run directly from desktop in Arch LinuxGnome launch item ignoring command line argumentsGnome 3: how to enable desktop actions in dock entries?Replacing the SSH agent in GNOME Shell, Wayland, and SystemDDetect if program should log to systemd journal or stdoutHow do I indicate the log level of a line of output from a systemd service?Scaling/HiDPI issue for QT5 applications under GNOMEopening pgadmin4 with one click in ubuntu gnomeHow do i use a different GTK theme for netbeans?

Wires do not connect in Circuitikz

Forward DNS request to my work's jump server

Commutative diagram using Tikzcd in footnote

Write a function

How to evaluate the performance of open source solver?

How do I use my adapted PS2 keyboard & mouse on a windows 10 computer?

Can a landlord force all residents to use the landlord's in-house debit card accounts?

Is space division multiplexing really multiplexing?

With a data transfer of 50 GB estimated 5 hours, are USB-C claimed speeds inaccurate or to blame?

Is it possible to complete a PhD in CS in 3 years?

Sense of humor in your sci-fi stories

What does "spinning upon the shoals" mean?

Why do airports remove/realign runways?

Need a non-volatile memory IC with near unlimited read/write operations capability

Curly braces adjustment in tikz?

What was the profession 芸者 (female entertainer) called in Russia?

What are the effects of abstaining from eating a certain flavor?

How do I separate enchants from items?

Other Space Shuttle O-ring failures

When do flights get cancelled due to fog?

What exactly is a "murder hobo"?

US citizen traveling with Peruvian passport

Passwordless authentication - how and when to invalidate a login code

I'm feeling like my character doesn't fit the campaign



How to execute a program from terminal redirecting stdout and stderr to systemd's journal?


Understand logging in LinuxOutput of a python script running as unit is out of order while shells seems unnafectedExecutable script can't run directly from desktop in Arch LinuxGnome launch item ignoring command line argumentsGnome 3: how to enable desktop actions in dock entries?Replacing the SSH agent in GNOME Shell, Wayland, and SystemDDetect if program should log to systemd journal or stdoutHow do I indicate the log level of a line of output from a systemd service?Scaling/HiDPI issue for QT5 applications under GNOMEopening pgadmin4 with one click in ubuntu gnomeHow do i use a different GTK theme for netbeans?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















Is there an easy way to run a command from the terminal the same way it is run from GNOME's Alt + F2, redirecting stdout and stderr to systemd's journal?



I've tried gmrun (does not redirect outputs), gtk-launch (works only for .desktop files in /usr/share/applications).



Is there a GNOME or a systemd command to do this?










share|improve this question









New contributor



Yves Dorfsman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 1





    See unix.stackexchange.com/questions/205883/… then you can figure out how to do this

    – 炸鱼薯条德里克
    8 hours ago

















2















Is there an easy way to run a command from the terminal the same way it is run from GNOME's Alt + F2, redirecting stdout and stderr to systemd's journal?



I've tried gmrun (does not redirect outputs), gtk-launch (works only for .desktop files in /usr/share/applications).



Is there a GNOME or a systemd command to do this?










share|improve this question









New contributor



Yves Dorfsman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 1





    See unix.stackexchange.com/questions/205883/… then you can figure out how to do this

    – 炸鱼薯条德里克
    8 hours ago













2












2








2








Is there an easy way to run a command from the terminal the same way it is run from GNOME's Alt + F2, redirecting stdout and stderr to systemd's journal?



I've tried gmrun (does not redirect outputs), gtk-launch (works only for .desktop files in /usr/share/applications).



Is there a GNOME or a systemd command to do this?










share|improve this question









New contributor



Yves Dorfsman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Is there an easy way to run a command from the terminal the same way it is run from GNOME's Alt + F2, redirecting stdout and stderr to systemd's journal?



I've tried gmrun (does not redirect outputs), gtk-launch (works only for .desktop files in /usr/share/applications).



Is there a GNOME or a systemd command to do this?







systemd gnome






share|improve this question









New contributor



Yves Dorfsman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Yves Dorfsman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 8 hours ago









terdon

138k33 gold badges283 silver badges461 bronze badges




138k33 gold badges283 silver badges461 bronze badges






New contributor



Yves Dorfsman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 8 hours ago









Yves DorfsmanYves Dorfsman

1112 bronze badges




1112 bronze badges




New contributor



Yves Dorfsman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Yves Dorfsman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









  • 1





    See unix.stackexchange.com/questions/205883/… then you can figure out how to do this

    – 炸鱼薯条德里克
    8 hours ago












  • 1





    See unix.stackexchange.com/questions/205883/… then you can figure out how to do this

    – 炸鱼薯条德里克
    8 hours ago







1




1





See unix.stackexchange.com/questions/205883/… then you can figure out how to do this

– 炸鱼薯条德里克
8 hours ago





See unix.stackexchange.com/questions/205883/… then you can figure out how to do this

– 炸鱼薯条德里克
8 hours ago










2 Answers
2






active

oldest

votes


















3














I think that you should use the logger(1) utility, which works no matter if your system is using systemd or rsyslogd.



your_prog 2>&1 | logger -t your_prog


On systems with systemd, there's also systemd-cat which is specifically using systemd's "streaming" logging api (sd_journal_stream_fd(3), /run/systemd/journal/stdout) instead of the standard syslog(3):



your_prog 2>&1 | systemd-cat -t your_prog

systemd-cat -t your_prog your_prog


To save another search: If you want to pipe only the stderr but not the stdout, you can use



log_stderr() logger -t "$1"; 3>&1; 
log_stderr your_prog





share|improve this answer
































    1














    systemd-run --user ...



    Unfortunately, the most user-friendly mode is not used by default.




    By default, services created with systemd-run default to the simple type [...] Consider using the exec service type (i.e. --property=Type=exec) to ensure that systemd-run returns successfully only if the specified command line has been successfully started.




    This more useful setting was added later. Personally, I do not think I would remember this detail. So I would prefer to use a short wrapper script.






    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
      );



      );






      Yves Dorfsman is a new contributor. Be nice, and check out our Code of Conduct.









      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f528696%2fhow-to-execute-a-program-from-terminal-redirecting-stdout-and-stderr-to-systemd%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      I think that you should use the logger(1) utility, which works no matter if your system is using systemd or rsyslogd.



      your_prog 2>&1 | logger -t your_prog


      On systems with systemd, there's also systemd-cat which is specifically using systemd's "streaming" logging api (sd_journal_stream_fd(3), /run/systemd/journal/stdout) instead of the standard syslog(3):



      your_prog 2>&1 | systemd-cat -t your_prog

      systemd-cat -t your_prog your_prog


      To save another search: If you want to pipe only the stderr but not the stdout, you can use



      log_stderr() logger -t "$1"; 3>&1; 
      log_stderr your_prog





      share|improve this answer





























        3














        I think that you should use the logger(1) utility, which works no matter if your system is using systemd or rsyslogd.



        your_prog 2>&1 | logger -t your_prog


        On systems with systemd, there's also systemd-cat which is specifically using systemd's "streaming" logging api (sd_journal_stream_fd(3), /run/systemd/journal/stdout) instead of the standard syslog(3):



        your_prog 2>&1 | systemd-cat -t your_prog

        systemd-cat -t your_prog your_prog


        To save another search: If you want to pipe only the stderr but not the stdout, you can use



        log_stderr() logger -t "$1"; 3>&1; 
        log_stderr your_prog





        share|improve this answer



























          3












          3








          3







          I think that you should use the logger(1) utility, which works no matter if your system is using systemd or rsyslogd.



          your_prog 2>&1 | logger -t your_prog


          On systems with systemd, there's also systemd-cat which is specifically using systemd's "streaming" logging api (sd_journal_stream_fd(3), /run/systemd/journal/stdout) instead of the standard syslog(3):



          your_prog 2>&1 | systemd-cat -t your_prog

          systemd-cat -t your_prog your_prog


          To save another search: If you want to pipe only the stderr but not the stdout, you can use



          log_stderr() logger -t "$1"; 3>&1; 
          log_stderr your_prog





          share|improve this answer















          I think that you should use the logger(1) utility, which works no matter if your system is using systemd or rsyslogd.



          your_prog 2>&1 | logger -t your_prog


          On systems with systemd, there's also systemd-cat which is specifically using systemd's "streaming" logging api (sd_journal_stream_fd(3), /run/systemd/journal/stdout) instead of the standard syslog(3):



          your_prog 2>&1 | systemd-cat -t your_prog

          systemd-cat -t your_prog your_prog


          To save another search: If you want to pipe only the stderr but not the stdout, you can use



          log_stderr() logger -t "$1"; 3>&1; 
          log_stderr your_prog






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 6 hours ago

























          answered 6 hours ago









          mosvymosvy

          14.8k2 gold badges18 silver badges48 bronze badges




          14.8k2 gold badges18 silver badges48 bronze badges























              1














              systemd-run --user ...



              Unfortunately, the most user-friendly mode is not used by default.




              By default, services created with systemd-run default to the simple type [...] Consider using the exec service type (i.e. --property=Type=exec) to ensure that systemd-run returns successfully only if the specified command line has been successfully started.




              This more useful setting was added later. Personally, I do not think I would remember this detail. So I would prefer to use a short wrapper script.






              share|improve this answer





























                1














                systemd-run --user ...



                Unfortunately, the most user-friendly mode is not used by default.




                By default, services created with systemd-run default to the simple type [...] Consider using the exec service type (i.e. --property=Type=exec) to ensure that systemd-run returns successfully only if the specified command line has been successfully started.




                This more useful setting was added later. Personally, I do not think I would remember this detail. So I would prefer to use a short wrapper script.






                share|improve this answer



























                  1












                  1








                  1







                  systemd-run --user ...



                  Unfortunately, the most user-friendly mode is not used by default.




                  By default, services created with systemd-run default to the simple type [...] Consider using the exec service type (i.e. --property=Type=exec) to ensure that systemd-run returns successfully only if the specified command line has been successfully started.




                  This more useful setting was added later. Personally, I do not think I would remember this detail. So I would prefer to use a short wrapper script.






                  share|improve this answer















                  systemd-run --user ...



                  Unfortunately, the most user-friendly mode is not used by default.




                  By default, services created with systemd-run default to the simple type [...] Consider using the exec service type (i.e. --property=Type=exec) to ensure that systemd-run returns successfully only if the specified command line has been successfully started.




                  This more useful setting was added later. Personally, I do not think I would remember this detail. So I would prefer to use a short wrapper script.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 6 hours ago

























                  answered 6 hours ago









                  sourcejedisourcejedi

                  28k5 gold badges47 silver badges128 bronze badges




                  28k5 gold badges47 silver badges128 bronze badges




















                      Yves Dorfsman is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded


















                      Yves Dorfsman is a new contributor. Be nice, and check out our Code of Conduct.












                      Yves Dorfsman is a new contributor. Be nice, and check out our Code of Conduct.











                      Yves Dorfsman is a new contributor. Be nice, and check out our Code of Conduct.














                      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%2f528696%2fhow-to-execute-a-program-from-terminal-redirecting-stdout-and-stderr-to-systemd%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

                      Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

                      The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

                      19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу