Visit Our UNIX and Linux User Community


How to mail the output of a command in AIX


 
Thread Tools Search this Thread
Operating Systems AIX How to mail the output of a command in AIX
# 1  
Old 10-18-2009
How to mail the output of a command in AIX

Hi,

I have mastered how to mail to Windows in AIX.

Can anyone tell me how I would mail the output command df -g to an email?

I want to set a job in cron to mail df -g as the contents of a mail.


Any ideas?

Thanks

John
# 2  
Old 10-18-2009
Hi.

Code:
df -g | mailx -s "subject" someone@somewhere ...

or

Code:
cat << ! | mailx .....
Here is a report of disk usage:
$(df -g)
!

or

Code:
df -g | uuencode disk_usage.txt | mailx ...

or

Code:
cat << ! | mailx ...
Attached is a report of disk usage.
$(df -g | uuencode disk_usage.txt)
!

# 3  
Old 10-18-2009
mail command

Hi Thanks for the speedy reply...

How do I mail from another user and the mail will only send when I exit out of the telnet session?

Any ideas?
# 4  
Old 10-18-2009
Quote:
I want to set a job in cron to mail df -g as the contents of a mail.
Hmm.


I don't know how you'd send the mail "from another user" apart from using sudo (or su if you're root).

And as I'm not at an AIX server now, I couldn't begin to tell you how to "automate" sending the email when you exit your terminal.

Why would you want to do either?
# 5  
Old 10-18-2009
mail command

Hi,

As I am doing it from a cron job I wont be able to do a ctrl-d.

It doesnt matter what user it is mailed from I was being curious.

The whole reason I want to do this is so I can recieve the mail each week to just keep an eye on the sizes so they dont fill up.

Thanks

Previous Thread | Next Thread
Test Your Knowledge in Computers #255
Difficulty: Easy
The consumer version of Mac OS X was launched in 2001 with Mac OS X 10.0.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unable to send mail with 'mail' command

I am unable to cause the 'mail' command to send mail from my linux ubuntu 15.10 computer. File 'mail.log' typically reports Connection timed out. I issue the command: mail -s "my subject" recipient@domain.com < filenamewhere filename is a file containing my message. Specifically, the... (3 Replies)
Discussion started by: tcnm
3 Replies

2. Shell Programming and Scripting

Insert title as output of command to appended file if no output from command

I am using UNIX to create a script on our system. I have setup my commands to append their output to an outage file. However, some of the commands return no output and so I would like something to take their place. What I need The following command is placed at the prompt: TICLI... (4 Replies)
Discussion started by: jbrass
4 Replies

3. Homework & Coursework Questions

Creating a function that sends a mail using mail command

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The function will be called m and it will allow you to send an email to someone using the mail command. The... (1 Reply)
Discussion started by: Drucian
1 Replies

4. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

5. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

6. Shell Programming and Scripting

AIX .ksh script freezes when using the mail -s command

Hello I am trying to send an email when a .KSH script is run on an AIX Machine. This email will only include a subject line that is made up of variables from within the script, and is as follows: CURRENT_DATE=`date +%Y%m%d` TIME=`date` ADMIN="myname@domain.com" date block () { ... (4 Replies)
Discussion started by: jimbojames
4 Replies

7. Shell Programming and Scripting

print output of a command in same as shell in mail : please help

i have written a simple script to print the out of a command and send an mail but i am not getting a shell output here .please see my script present output is like this i need an output as same as shell Postfix log summaries for Jan 24 Grand Totals ------------ messages 1432 received 1439... (2 Replies)
Discussion started by: unimaxlin
2 Replies

8. UNIX for Dummies Questions & Answers

AIX: mail command & server

Hi, I have to change the mail server, but I could not find the file where it is written in. I use the following command: </> echo krneki | mail -v -s "New report" receiver@our.comp Server name ("skala") can be seen in a terminal output .... receiver@our.comp ... Connecting to... (0 Replies)
Discussion started by: frajer
0 Replies

9. UNIX for Dummies Questions & Answers

Command display output on console and simultaneously save the command and its output

Hi folks, Please advise which command/command line shall I run; 1) to display the command and its output on console 2) simultaneous to save the command and its output on a file I tried tee command as follows; $ ps aux | grep mysql | tee /path/to/output.txt It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies

10. UNIX for Dummies Questions & Answers

Capturing output from grpck command on AIX

I'm having trouble capturing output from the following command on AIX: grpck -n ALL > error.out It gives me the results on the screen but my file is blank. I have no trouble capturing output from "ls > ls.out", but doesn't seem to work with the grpck command. Any ideas? Thanks. (2 Replies)
Discussion started by: pdtak
2 Replies

Featured Tech Videos