Visit The New, Modern Unix Linux Community

Trying to email text, getting blank email

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trying to email text, getting blank email
# 1  
Trying to email text, getting blank email

Hello, and thank you for help in advance, i seem to have this script working, except for the email part, it sends me a blank email, am i not redirecting the output of my text file the right way?


rm installed_zones.txt


for EACH in `cat serverlist.txt`
ssh $EACH zoneadm list -ipc | grep running | grep -v "global" >> installed_zones.txt

if [ -s installed_zones.txt ] ; then
cat /home/xxx/stuff/installed_zones.txt | mail

Last edited by BG_JrAdmin; 11-23-2011 at 06:26 PM..
# 2  
Maybe just -s "subject..." missing ?
# 3  
for EACH in `cat serverlist.txt`
ssh $EACH zoneadm list -ipc | grep running | grep -v "global" >> installed_zones.txt

Useless use of cat, dangerous use of backticks. You don't need to run grep 18,000 times for 9,000 hosts either. This would be faster and more reliable:

while read EACH
        ssh "$EACH" zoneadm list -ipc
done < serverlist.txt | grep running | grep -v "global" > installed_zones.txt

cat /home/galanteb/stuff/installed_zones.txt | mail

Another useless use of cat, though probably not as big a deal. Redirect in a file with < instead. Also, as vbe says, try giving it a subject.

mail -s "subject" < /home/galanteb/stuff/installed_zones.txt

# 4  
i could not get "mail" to work, this is solaris 10. this below finally worked. I appreciate your help!

/usr/ucb/mail -s "ZONES INSTALLED BUT NOT RUNNING" < installed_zones.txt

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #533
Difficulty: Easy
A Boolean is type of variable that is used to hold a truth value, either true or false.
True or False?

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding a blank line in between two O/Ps in tabular format which gets received over email

Hi Guys, I am stuck in between and seeking help here. Requirement: A script that will run every morning which will connect to Mysql database and run the query to inform us about the holidays (it will also check if there were any holidays during last 2 business days). So the three queries are... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

2. Shell Programming and Scripting

Getting email output in single line with out space in email

I have tried below email method and i am getting every thing in single line . i have put echo to provide space, but it is not helping my code ( echo "From: $FROM" echo "To: $MAILTO" echo "CC: $CC" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed;... (6 Replies)
Discussion started by: mirwasim
6 Replies

3. SuSE

Send outgoing email to my GroupWise email

Dear users, I have Linux server whose versions are Suse 10 SP 3 and Suse 11. I am trying to send email from these servers to my GroupWise email account. In /etc/postfix/ file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Discussion started by: JDBA
0 Replies

4. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

5. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

6. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

7. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : I want to send email like malix -s "TEST" < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

8. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

Featured Tech Videos