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;
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
New contributor
add a comment |
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
New contributor
1
See unix.stackexchange.com/questions/205883/… then you can figure out how to do this
– 炸鱼薯条德里克
8 hours ago
add a comment |
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
New contributor
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
systemd gnome
New contributor
New contributor
edited 8 hours ago
terdon♦
138k33 gold badges283 silver badges461 bronze badges
138k33 gold badges283 silver badges461 bronze badges
New contributor
asked 8 hours ago
Yves DorfsmanYves Dorfsman
1112 bronze badges
1112 bronze badges
New contributor
New contributor
1
See unix.stackexchange.com/questions/205883/… then you can figure out how to do this
– 炸鱼薯条德里克
8 hours ago
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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
add a comment |
systemd-run --user ...
Unfortunately, the most user-friendly mode is not used by default.
By default, services created with
systemd-run
default to thesimple
type [...] Consider using theexec
service type (i.e.--property=Type=exec
) to ensure thatsystemd-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.
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
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
add a comment |
add a comment |
systemd-run --user ...
Unfortunately, the most user-friendly mode is not used by default.
By default, services created with
systemd-run
default to thesimple
type [...] Consider using theexec
service type (i.e.--property=Type=exec
) to ensure thatsystemd-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.
add a comment |
systemd-run --user ...
Unfortunately, the most user-friendly mode is not used by default.
By default, services created with
systemd-run
default to thesimple
type [...] Consider using theexec
service type (i.e.--property=Type=exec
) to ensure thatsystemd-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.
add a comment |
systemd-run --user ...
Unfortunately, the most user-friendly mode is not used by default.
By default, services created with
systemd-run
default to thesimple
type [...] Consider using theexec
service type (i.e.--property=Type=exec
) to ensure thatsystemd-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.
systemd-run --user ...
Unfortunately, the most user-friendly mode is not used by default.
By default, services created with
systemd-run
default to thesimple
type [...] Consider using theexec
service type (i.e.--property=Type=exec
) to ensure thatsystemd-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.
edited 6 hours ago
answered 6 hours ago
sourcejedisourcejedi
28k5 gold badges47 silver badges128 bronze badges
28k5 gold badges47 silver badges128 bronze badges
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
See unix.stackexchange.com/questions/205883/… then you can figure out how to do this
– 炸鱼薯条德里克
8 hours ago