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?

Intern not wearing safety equipment; how could I have handled this differently?

Is this car delivery via Ebay Motors on Craigslist a scam?

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

Can the word "desk" be used as a verb?

Strong Password Detection in Python

How to "add vert" in blender 2.8?

How can I review my manager, who is fine?

How do I explain that I don't want to maintain old projects?

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

Moving millions of files to a different directory with specfic name patterns

Clarinets in the Rite of Spring

Why is a mixture of two normally distributed variables only bimodal if their means differ by at least two times the common standard deviation?

Gory anime with pink haired girl escaping an asylum

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

Why do airports remove/realign runways?

Curly braces adjustment in tikz?

How to slice a string input at a certain unknown index

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

Was it ever illegal to name a pig "Napoleon" in France?

Chilling water in copper vessel

Is there a formal/better word than "skyrocket" for the given context?

US citizen traveling with Peruvian passport

Computer name naming convention for security

Can "expliquer" be followed by "que" and the subjunctive?



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

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її