nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Require Shell Script Which sends all server info on mail

This is a discussion on Require Shell Script Which sends all server info on mail within the Linux software forums, part of the Linux Getting Started category; Dear All. I require a shell script for Linux, which sends me a all logs file ,space available on server ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 10-25-2006, 01:13 AM
Member
User
 
Join Date: Mar 2006
Posts: 63
puppen
Default Require Shell Script Which sends all server info on mail

Dear All.

I require a shell script for Linux, which sends me a all logs file ,space available on server and when server is rebooted in particular time interval. So all the information I want on my mail.

This problem is that my Linux server does not have public ip so it should forward mail to particular MTA.

Basically I want all the server information on my mail in every 1 hour time.
Is there any way I can do it, Pls help me.
__________________
someone somewhere is made for you.
LOVE is Journey not a destination.
ALL I want is EVERYTHING.
Reply With Quote
  #2 (permalink)  
Old 10-25-2006, 08:37 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 479
monk is an unknown quantity at this point
Default

There is a program called nbsmtp. It allows to specify which MTA you would like to use.
Download and compile program http://nbsmtp.ferdyx.org/

Code:
cat /tmp/mail.txt | ./nbsmtp -f you@yourdot.com -h remote.relay.email.server.com -p 25 -u smtp-user -p smtp-passwd -M 1
or
Code:
./nbsmtp -f you@yourdot.com -h remote.relay.email.server.com -p 25 -u smtp-user -p smtp-passwd -M 1 < /tmp/mail.txt
Reply With Quote
  #3 (permalink)  
Old 10-25-2006, 07:17 PM
Member
User
 
Join Date: Mar 2006
Posts: 63
puppen
Default

Dear Monk.

Thanks for your reply, I do not know whether u have understand my point or not.

Simplt what I want is all server logs and how much space available on server, shoud automatically come on my mail.
I have another server which works as MTA it just sends a mail to internet cloud.
So I want is my limus server send a mail to this server with all info and this server forward a mail to any mail ID may be Yahoo or Gmail.

Waiting for your reply.

Regards.
__________________
someone somewhere is made for you.
LOVE is Journey not a destination.
ALL I want is EVERYTHING.
Reply With Quote
  #4 (permalink)  
Old 10-25-2006, 08:07 PM
sweta's Avatar
Contributors
User
 
Join Date: Feb 2005
Location: New Delhi
My distro: Suse, RHEL, Vista
Posts: 150
sweta is an unknown quantity at this point
Default

Use mail command to send email
Code:
mail -s "subject" me@yahoo.com < log.file.txt
Use matt command to send an email attachment
Code:
mutt -s "subect" -a  /var/log/mail.log  me@yahoo.com < /dev/null
You need to configure sendmail as null mail client to forward all mail to central mail server or MTA hub.

What monk told is quite advance and it is only recommended if you need to authenticate SSL mail or in chrooted jail.
__________________
Friends - v-nessa - missyAdmin
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Tomcat shell script cron job to restart server kasimani Shell scripting 4 05-03-2008 07:46 PM
shell script to send mail for each login. ephdia Shell scripting 2 11-27-2007 04:42 PM
bash script to collect info adahan Shell scripting 7 10-31-2007 06:06 PM
Require shell script using rsync puppen Shell scripting 4 04-23-2006 12:52 AM
require shell script puppen Shell scripting 4 04-12-2006 09:42 PM


All times are GMT +5.5. The time now is 09:36 PM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30