piping command output to email

piping command output to email

Post by Peter Steel » Fri, 18 Jun 1999 04:00:00



Can anyone tell me how to take the output of a command such as df and email
it? I am trying the following:

df -k | mailx -s "testing" joesmith

and it isn't working. I know I can redirect the command output to a file and
then send the file, but I
want a "oneliner" if possible.

thanks,

peter steele

 
 
 

piping command output to email

Post by perrisc.. » Fri, 18 Jun 1999 04:00:00




Quote:> Can anyone tell me how to take the output of a command such as df and
email
> it? I am trying the following:

> df -k | mailx -s "testing" joesmith

I don't know why that's not working for you, it works fine here on AIX
4.3.2:

/usr/informix # df -k /usr | mailx -s "test" perrism
/usr/informix # su - perrism
[YOU HAVE NEW MAIL]
$ mail
Mail [5.2 UCB] [AIX 4.1]  Type ? for help.
"/var/spool/mail/perrism": 1 message 1 new

Quote:>N  1 root              Thu Jun 17 16:07  11/447  "test"

? 1
Message  1:
From root Thu Jun 17 16:07:25 1999
Date: Thu, 17 Jun 1999 16:07:24 +0100
From: root
To: perrism
Subject: test

Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd2           655360     65156   91%    14579     9% /usr

Are you getting nothing in the email at all?

rgds,
Michael.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

piping command output to email

Post by Walsh Brow » Fri, 18 Jun 1999 04:00:00




> Can anyone tell me how to take the output of a command such as df and
email
> it? I am trying the following:

> df -k | mailx -s "testing" joesmith

> and it isn't working. I know I can redirect the command output to a
file and
> then send the file, but I
> want a "oneliner" if possible.

> thanks,

> peter steele


Peter,

That syntax should work.  Make sure that you have a valid username and
make sure that df -k is generating the output that you think it is.  Are
you getting an error message at the command line?  If not, then the mail
is going SOMEWHERE.  Check your own mail to see if you are getting
mailer daemon return messages.  See if you can send a regular message to
the user.  Make sure that your sendmail (sendmail.cf) configuration is
correct (good luck).

-- Walsh
--
Walsh Brown

Sometimes I sit and think...sometimes I just sit.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

piping command output to email

Post by Tony R. Benne » Fri, 18 Jun 1999 04:00:00




>Can anyone tell me how to take the output of a command such as df and email
>it? I am trying the following:

>df -k | mailx -s "testing" joesmith

>and it isn't working. I know I can redirect the command output to a file and
>then send the file, but I
>want a "oneliner" if possible.

>thanks,

>peter steele


I tried this on a 3.2.5 system...empty message because '-k' isn't valid.
                                 but mail was sent.
         and on a 4.3.1 system...worked properly.

Does user 'joesmith' have an account on the system you are running the
command upon???

--


 
 
 

1. Piping output to a C-shell script from another command - HOW?

I have written a printing program in C-shell script which accepts command-
line arguments. The usage is as follows:

print [-p printer] [-f format] [-s papersize] [-o orientation] file...

I want to adapt it so that if the user can do the following sort of
thing

ls | print -p laser -f text

ie. so that the output from ls comes out on the printer.

At the moment, you have to enter a filename to print.

Can anyone please tell me how to do this sort of thing in C-shell
programming?(The program works perfectly as it now stands, but
I would like to be able to pipe output from Unix commands such as
ls to it).

Any suggestions would be greatly appreciated!

Thanks in advance.

Tim Porter.
Forestry Authority Research (Forestry Commission).

PS. I am using SunOS 4.1.2 on Suns.

2. Linking Problem With TCP Socket Program

3. Solution for "pipe output command into read variable" (see also bash faq E4)

4. How to setup an ntp server?

5. Pipe command output to listbox

6. Multiport serial I/O, Connect Tech Inc

7. How to pipe compress output to tar command

8. Linux/m68k Registration Site

9. Piping output of "time" command

10. how to pipe a command output to grep???

11. Piping output of "time" command

12. how to pipe the output of the builtin 'jobs' command ?

13. Why Does Piping Output to an Executable Change the Way it Outputs?