FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 07-02-2011, 08:36 PM
Nils Kassube
 
Default services output oddity

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@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

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-02-2011, 08:42 PM
Dave Stevens
 
Default services output oddity

Quoting Nils Kassube <kassube@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@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@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


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-02-2011, 09:05 PM
Tom H
 
Default services output oddity

On Sat, Jul 2, 2011 at 4:20 PM, Dave Stevens <geek@uniserve.com> wrote:
>
> It's handy to check that some service or other is up and running without
> necessarily invoking the service. Enter the U10.04 service command.
>
> # service --status-all > servicesrunning.txt
> *[ ? ] *anacron
> *[ ? ] *console-screen.sh
> *[ ? ] *cron
> *[ ? ] *fetchmail
> *[ ? ] *hostname
> *[ ? ] *hwclock
> *[ ? ] *hwclock-save
> *[ ? ] *keymap.sh
> *[ ? ] *killprocs
> *[ ? ] *libpam-foreground
> *[ ? ] *mailman
> *[ ? ] *module-init-tools
> *[ ? ] *modules_dep.sh
> *[ ? ] *mysql
> *[ ? ] *network-interface
> *[ ? ] *network-interface-security
> *[ ? ] *networking
> *[ ? ] *nmbd
> *[ ? ] *ondemand
> *[ ? ] *plymouth
> *[ ? ] *plymouth-log
> *[ ? ] *plymouth-splash
> *[ ? ] *plymouth-stop
> *[ ? ] *portmap
> *[ ? ] *portmap-boot
> *[ ? ] *portmap-wait
> *[ ? ] *procps
> *[ ? ] *rc.local
> *[ ? ] *saslauthd
> *[ ? ] *screen-cleanup
> *[ ? ] *sendsigs
> *[ ? ] *smbd
> *[ ? ] *stop-bootlogd
> *[ ? ] *stop-bootlogd-single
> *[ ? ] *udev
> *[ ? ] *udev-finish
> *[ ? ] *udevmonitor
> *[ ? ] *udevtrigger
> *[ ? ] *umountfs
> *[ ? ] *umountnfs.sh
> *[ ? ] *umountroot
> *[ ? ] *usermin
> *[ ? ] *vzquota
> *[ ? ] *webmin
>
> 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@cl28810:~$ cat servicesrunning.txt
> *[ + ] *apache2
> *[ + ] *bind9
> *[ - ] *bootlogd
> *[ + ] *clamav-daemon
> *[ + ] *clamav-freshclam
> *[ - ] *dovecot
> *[ - ] *klogd
> *[ - ] *postfix
> *[ + ] *postgresql-8.4
> *[ + ] *proftpd
> *[ + ] *quota
> *[ - ] *quotarpc
> *[ - ] *rsync
> *[ - ] *sendmail
> *[ + ] *spamassassin
> *[ + ] *ssh
> *[ + ] *sysklogd
> *[ + ] *sysstat
> *[ - ] *urandom
> *[ - ] *wide-dhcpv6-client
> *[ + ] *xinetd
>
> So NOT the same text, less detail. Apparently only a summary goes into the
> text file.
>
> Anyone know why this behaviour? Why on screen, why summary only on file?

It's stderr that's displayed and stdout that's saved to "servicesrunning.txt".

If you want everything to end up in "servicesrunning.txt", you have to
run "service --status-all > servicesrunning.txt 2>&1".

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 01:13 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org