services output oddity
Dave Stevens
geek at uniserve.com
Sat Jul 2 20:42:43 UTC 2011
Quoting Nils Kassube <kassube at gmx.net>:
> Dave Stevens wrote:
>> # service --status-all > servicesrunning.txt
>> [ ? ] anacron
>> [ ? ] console-screen.sh
> [...]
>> given the command line above I would have expected the output text to
>> go into a file called servicesrunning.txt, not on screen. But the
>> above output is the screen text.
>>
>> There IS text in the new file servicesrunning.txt, like this:
>>
>> dave at cl28810:~$ cat servicesrunning.txt
>> [ + ] apache2
>> [ + ] bind9
> [...]
>
> What you see on the screen is sent to the standard error while the
> standard output is sent to your text file. If you want to have both in
> the same file, use this command:
>
> service --status-all > servicesrunning.txt 2>&1
>
> That way the standard error is redirected to the standard output and
> both are redirected to your text file.
>
>
> Nils
yes, that works nicely, thanks very much.
Dave
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
--
"It is no measure of health to be well adjusted to a profoundly sick society."
Krishnamurti
More information about the ubuntu-users
mailing list