LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-04-2008, 11:39 AM   #16
xmdms
Member
 
Registered: Oct 2003
Posts: 134

Original Poster
Rep: Reputation: 15

Quote:
Originally Posted by vikas027 View Post
For using ssh without password follow these steps:

1) ssh-keygen -t dsa (or rsa)
2) press enter until prompt comes again.
3) two files will be in $HOME/.ssh directory.
id_rsa
id_rsa.pub
4) now simply copy the content of this file, to the $HOME/.ssh/authorized_keys file of the other server.
Thank you!!

How would I change the syntax of my script by adding a "From", to tell it from a legitimate e-mail account??

Example:
From: real.user@yahoo.comTo: xmdms@yahoo.com
Subject: Disk Space is low

Your disk space on ______ please check!!
 
Old 09-05-2008, 04:15 AM   #17
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Debian, OS X
Posts: 1,298

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by xmdms View Post
Thank you!!

How would I change the syntax of my script by adding a "From", to tell it from a legitimate e-mail account??

Example:
From: real.user@yahoo.comTo: xmdms@yahoo.com
Subject: Disk Space is low

Your disk space on ______ please check!!
I could not understand you, you want to inform the user about the disk utilization ??
 
Old 09-05-2008, 08:27 AM   #18
xmdms
Member
 
Registered: Oct 2003
Posts: 134

Original Poster
Rep: Reputation: 15
Question

Quote:
Originally Posted by vikas027 View Post
I could not understand you, you want to inform the user about the disk utilization ??
As you can see from the script below. I would like to know what's the command lines for adding "From" rather than have it coming Root as the user sending the e-mail message.

Example:

RECIPENTS="xmdms@yahoo.com"
typeset -i error="92"
if [ -e \tmp\space.out ]; then
rm \tmp\space.out
fi
for disk in `mount | egrep '^/dev' | egrep -iv 'cdrom|proc|sys|pts' |awk '{print $3}'`
do
typeset -i diskUsage=`df -h $disk|cut -c40-42|grep -i [^a-z]`
if [ "$diskUsage" -ge "$error" ]; then
echo "Disk usage $disk exceeded the threshold of $diskUsage%" >> \tmp\space.txt
fi
done
if [ -e \tmp\space.out ]; then
message=`cat \tmp\space.out`
fi
if [ ${#message} -gt 0 ]; then
cat \tmp\space.out | mail -s "Disk Usage Report for: $HOSTNAME" $RECIPENTS
fi
 
Old 09-05-2008, 09:50 AM   #19
CRC123
Member
 
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
mail -r you@domain.com -s "Disk Usage Report for: $HOSTNAME" $RECIPENTS
 
Old 09-05-2008, 11:11 AM   #20
xmdms
Member
 
Registered: Oct 2003
Posts: 134

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by CRC123 View Post
mail -r you@domain.com -s "Disk Usage Report for: $HOSTNAME" $RECIPENTS
'-r' is not an option for mail. I get an error when running with an '-r' option. The man page doesn't display an option for -r either.

Please advice.

Thanks!!

mail: invalid option -- r
Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...
[- sendmail-options ...]
mail [-iInNv] -f [name]
mail [-iInNv] [-u user]
 
Old 09-05-2008, 12:00 PM   #21
CRC123
Member
 
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
Hmm, mine works, but my 'mail' command is a symbolic link to the 'mailx' program. Do you have a 'mailx' program on your computer?
 
Old 09-05-2008, 12:13 PM   #22
xmdms
Member
 
Registered: Oct 2003
Posts: 134

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by CRC123 View Post
Hmm, mine works, but my 'mail' command is a symbolic link to the 'mailx' program. Do you have a 'mailx' program on your computer?
That's the problem. I am running RHAS 4.0 - You're probably running older version of Redhat or something else. I do know that Unix also used mailx, but not here.

I wonder.....
 
Old 09-05-2008, 01:54 PM   #23
CRC123
Member
 
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
Im on opensuse 11.0, but in my man pages, it says that if you set the 'from' or 'FROM' variable, it should use that as the "from" address of mail addresses, so try this:

Code:
export from="myemail@blah.com"
or
export FROM="myemail@blah.com"
I hope that helps, otherwise, I dunno.
 
Old 09-05-2008, 03:14 PM   #24
xmdms
Member
 
Registered: Oct 2003
Posts: 134

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by CRC123 View Post
Im on opensuse 11.0, but in my man pages, it says that if you set the 'from' or 'FROM' variable, it should use that as the "from" address of mail addresses, so try this:

Code:
export from="myemail@blah.com"
or
export FROM="myemail@blah.com"
I hope that helps, otherwise, I dunno.
Came back as nothing for both commands. My man page displayed,

OPTIONS
The mailx utility shall conform to the Base Definitions volume of
IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.

The following options shall be supported. (Only the -s subject option
shall be required on all systems. The other options are required only
on systems supporting the User Portability Utilities option.)

-e Test for the presence of mail in the system mailbox. The mailx
utility shall write nothing and exit with a successful return
code if there is mail to read.

-f Read messages from the file named by the file operand instead
of the system mailbox. (See also folder.) If no file operand is
specified, read messages from mbox instead of the system mail-
box.

-F Record the message in a file named after the first recipient.
The name is the login-name portion of the address found first
on the To: line in the mail header. Overrides the record vari-
-H Write a header summary only.

-i Ignore interrupts. (See also ignore.)

-n Do not initialize from the system default start-up file. See
the EXTENDED DESCRIPTION section.

-N Do not write an initial header summary.

-s subject
Set the Subject header field to subject. All characters in the
subject string shall appear in the delivered message. The
results are unspecified if subject is longer than {LINE_MAX} -
10 bytes or contains a <newline>.

able, if set (see Internal Variables in mailx .)
-u user
Read the system mailbox of the login name user. This shall only
be successful if the invoking user has the appropriate privi-
leges to read the system mailbox of that user.


I guess, I will just have to setup the relay to our Windows Mail Server.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with freeing disk space on a two hard disk Fedora Core 4 box favadalikhan Linux - Server 1 04-29-2008 10:04 PM
[SOLVED] Shell script to monitor or watch the disk space.... small help needed vikas027 Programming 5 10-21-2007 11:04 AM
LXer: Perl script to monitor disk space and send an email alert LXer Syndicated Linux News 1 02-23-2007 02:12 PM
Monitor disk space without gkrellm BroX Slackware 3 02-24-2006 04:21 PM
Disk space wastage 73 GB Hard disk rajgopalhg Linux - Hardware 2 10-18-2002 04:41 PM


All times are GMT -5. The time now is 04:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration