diff --git a/Makefile.am b/Makefile.am
index d2bd3404ce4..1e07ebae355 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -691,7 +691,8 @@ MANPAGES = \
man/machine-info.5 \
man/modules-load.d.5 \
man/sysctl.d.5 \
- man/systemd-ask-password.1
+ man/systemd-ask-password.1 \
+ man/systemd-cat.1
MANPAGES_ALIAS = \
man/reboot.8 \
diff --git a/man/systemd-cat.xml b/man/systemd-cat.xml
new file mode 100644
index 00000000000..41b36853788
--- /dev/null
+++ b/man/systemd-cat.xml
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+
+ systemd-cat
+ systemd
+
+
+
+ Developer
+ Lennart
+ Poettering
+ lennart@poettering.net
+
+
+
+
+
+ systemd-cat
+ 1
+
+
+
+ systemd-cat
+ Connect a pipeline or program's output with the journal
+
+
+
+
+ systemd-cat OPTIONSCOMMANDARGUMENTS
+
+
+ systemd-cat OPTIONS
+
+
+
+
+ Description
+
+ systemd-cat may be used to
+ connect STDOUT and STDERR of a process with the
+ journal, or as a filter tool in a shell pipeline to
+ pass the output the previous pipeline element
+ generates to the journal.
+
+ If no parameter is passed
+ systemd-command will write
+ everything it reads from standard input (STDIN) to the journal.
+
+ If parameters are passed they are executed as
+ command line with standard output (STDOUT) and standard
+ error output (STDERR) connected to the journal, so
+ that all it writes is stored in the journal.
+
+
+
+ Options
+
+ The following options are understood:
+
+
+
+
+
+
+ Prints a short help
+ text and exits.
+
+
+
+
+
+ Prints a short version
+ string and exits.
+
+
+
+
+
+
+ Specify a short string
+ that is used to identify the logging
+ tool. If not specified no identifying
+ string is written to the journal.
+
+
+
+
+
+
+ Specify the default
+ priority level for the logged
+ messages. Pass one of
+ emerg,
+ alert,
+ crit,
+ err,
+ warning,
+ notice,
+ info,
+ debug, resp. a
+ value between 0 and 7 (corresponding
+ to the same named levels). These
+ priority values are the same as
+ defined by
+ syslog3. Defaults
+ to info. Note that
+ this simply controls the default,
+ individual lines may be logged with
+ different levels if they are prefixed
+ accordingly. For details see
+
+ below.
+
+
+
+
+
+ Controls whether lines
+ read are parsed for syslog priority
+ level prefixes. If enabled (the
+ default) a line prefixed with a
+ priority prefix such as
+ <5> is logged
+ at priority 5
+ (notice), and
+ similar for the other priority
+ levels. Takes a boolean
+ argument.
+
+
+
+
+
+
+
+ Exit status
+
+ On success 0 is returned, a non-zero failure
+ code otherwise.
+
+
+
+ Examples
+
+
+ Invoke a program
+
+ This calls /bin/ls
+ with STDOUT/STDERR connected to the
+ journal:
+
+ # systemd-cat ls
+
+
+
+ Usage in a shell pipeline
+
+ This builds a shell pipeline also
+ invoking /bin/ls and
+ writes the output it generates to the
+ journal:
+
+ # ls | systemd-cat
+
+
+ Even though the two examples have very similar
+ effects the first is preferable since only one process
+ is running at a time, and both STDOUT and STDERR are
+ captured while in the second example only STDOUT is
+ captured.
+
+
+
+ See Also
+
+ systemd1,
+ systemctl1,
+ logger1
+
+
+
+
diff --git a/man/systemd-notify.xml b/man/systemd-notify.xml
index 59d6b2fd877..c5ffafe895a 100644
--- a/man/systemd-notify.xml
+++ b/man/systemd-notify.xml
@@ -94,6 +94,13 @@
text and exits.
+
+
+
+ Prints a short version
+ string and exits.
+
+
diff --git a/src/journal/cat.c b/src/journal/cat.c
index 6745f1ce0ac..31d76f33bb8 100644
--- a/src/journal/cat.c
+++ b/src/journal/cat.c
@@ -59,7 +59,7 @@ static int parse_argv(int argc, char *argv[]) {
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
- { "version" , no_argument, NULL, ARG_VERSION },
+ { "version", no_argument, NULL, ARG_VERSION },
{ "identifier", required_argument, NULL, 't' },
{ "priority", required_argument, NULL, 'p' },
{ "level-prefix", required_argument, NULL, ARG_LEVEL_PREFIX },
@@ -139,7 +139,7 @@ int main(int argc, char *argv[]) {
fd = sd_journal_stream_fd(arg_identifier, arg_priority, arg_level_prefix);
if (fd < 0) {
- log_error("Failed to create stream fd: %s", strerror(fd));
+ log_error("Failed to create stream fd: %s", strerror(-fd));
r = fd;
goto finish;
}
@@ -148,7 +148,7 @@ int main(int argc, char *argv[]) {
if (dup3(fd, STDOUT_FILENO, 0) < 0 ||
dup3(fd, STDERR_FILENO, 0) < 0) {
- log_error("Failed to duplicate fd: %s", strerror(fd));
+ log_error("Failed to duplicate fd: %m");
r = -errno;
goto finish;
}
@@ -163,12 +163,13 @@ int main(int argc, char *argv[]) {
else
execvp(argv[optind], argv + optind);
+ r = -errno;
+
/* Let's try to restore a working stderr, so we can print the error message */
if (saved_stderr >= 0)
dup3(saved_stderr, STDERR_FILENO, 0);
- log_error("Failed to execute process: %m");
- r = -errno;
+ log_error("Failed to execute process: %s", strerror(-r));
finish:
if (fd >= 0)
diff --git a/src/notify.c b/src/notify.c
index 9d52bdfdd34..943808eb0d6 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -33,6 +33,7 @@
#include "util.h"
#include "log.h"
#include "sd-readahead.h"
+#include "build.h"
static bool arg_ready = false;
static pid_t arg_pid = 0;
@@ -45,6 +46,7 @@ static int help(void) {
printf("%s [OPTIONS...] [VARIABLE=VALUE...]\n\n"
"Notify the init system about service status updates.\n\n"
" -h --help Show this help\n"
+ " --version Show package version\n"
" --ready Inform the init system about service start-up completion\n"
" --pid[=PID] Set main pid of daemon\n"
" --status=TEXT Set status text\n"
@@ -59,6 +61,7 @@ static int parse_argv(int argc, char *argv[]) {
enum {
ARG_READY = 0x100,
+ ARG_VERSION,
ARG_PID,
ARG_STATUS,
ARG_BOOTED,
@@ -67,6 +70,7 @@ static int parse_argv(int argc, char *argv[]) {
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, ARG_VERSION },
{ "ready", no_argument, NULL, ARG_READY },
{ "pid", optional_argument, NULL, ARG_PID },
{ "status", required_argument, NULL, ARG_STATUS },
@@ -88,6 +92,12 @@ static int parse_argv(int argc, char *argv[]) {
help();
return 0;
+ case ARG_VERSION:
+ puts(PACKAGE_STRING);
+ puts(DISTRIBUTION);
+ puts(SYSTEMD_FEATURES);
+ return 0;
+
case ARG_READY:
arg_ready = true;
break;