You are not logged in.

#1 2009-12-24 20:06:13

Gumper
Member
From: U.S.A.
Registered: 2009-10-26
Posts: 132

Help setting up cron to send me emails

I'm currently using cron to run daily backups of my system and to also run rkhunter. When I was using openSUSE I could set up my email to check my local account. I believe that I need "postfix" to be able to do this so I installed it. What else do I need to do besides having this program installed?  When I try to add the local account in kmail it is asking me to select a file location. I'm not sure what file to select here. In openSUSE it was already selected for me. Any ideas?

Thanks!


Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.

Offline

#2 2009-12-24 20:15:11

Kitty
Member
From: The Burning Desert
Registered: 2008-01-11
Posts: 88

Re: Help setting up cron to send me emails

What does "echo $MAIL" give you? Also check "ls /var/mail/"


/etc/rc.d/ is where daemons reside. Beware.

Offline

#3 2009-12-24 20:40:28

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Help setting up cron to send me emails

edit: bah, ignore this.

Last edited by falconindy (2009-12-24 20:41:16)

Offline

#4 2009-12-24 22:24:49

JuseBox
Member
Registered: 2009-11-27
Posts: 260

Re: Help setting up cron to send me emails

Might want to also check your ISP allowing port 25...


Linux ArchLinux 3.2.8-1-ARCH
#1 SMP PREEMPT Mon Feb 27 21:51:46 CET 2012 x86_64 AMD FX(tm)-8120 Eight-Core Processor AuthenticAMD GNU/Linux
8192MB DDR3 1300MHz | Asus m5a97 | GeForce GTX 550 Ti | 120 GB SSD

Offline

#5 2009-12-25 03:42:49

Gumper
Member
From: U.S.A.
Registered: 2009-10-26
Posts: 132

Re: Help setting up cron to send me emails

Kitty wrote:

What does "echo $MAIL" give you? Also check "ls /var/mail/"

Neither command returns anything.


Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.

Offline

#6 2009-12-25 09:13:23

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: Help setting up cron to send me emails

I'm no expert on postfix and used to rely on the PostFix HostOnly Howto page in the wiki.  Unfortunately, that page got deleted a week or so ago and the content doesn't appear to have been copied into either of the other two postfix pages.  Anyway, this is the gist of what it contained:

From http://wiki.archlinux.org/index.php/PostFix_HostOnly_Howto (since deleted)

$ pacman -Sy postfix

Check /etc/passwd, /etc/group to make sure that the following shows up:

postfix:x:73:73::/var/spool/postfix:/bin/false

Make sure that the following shows up in /etc/group:

postdrop:x:75:
postfix:x:73:

Edit /etc/postfix/main.cf and add the following:

inet_interfaces = loopback-only
mynetworks_style = host
append_dot_mydomain = no
default_transport = error: Local delivery only!

Edit /etc/rc.conf and add postfix to the daemons list.

Edit /etc/postfix/aliases and add a username to receive root email, i.e. put a
username in for the the following, substituting the desired actual system
account name for USER:

# Person who should get root's mail. Don't receive mail as root!
root:           USER

Run the following command to create a map file for postfix:

$ postalias /etc/postfix/aliases

Create .forward in /root containing the mail address of the user to whom all
mail for root will be forwarded, e.g. USER@localhost

Start the postfix daemon by running

$ postfix check

followed by

$ /etc/rc.d/postfix start

Check /var/log/mail.log for any errors.

Try sending an email:

$ mail -s test USER
this is a test email.
.

Last edited by azleifel (2009-12-25 09:35:58)

Offline

#7 2009-12-25 13:59:18

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: Help setting up cron to send me emails

Ooop big_smile

Last edited by Gen2ly (2009-12-25 14:00:07)


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#8 2009-12-25 15:52:23

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: Help setting up cron to send me emails

Me oopsied too.  Found the page: http://wiki.archlinux.org/index.php/Loc … th_Postfix

Offline

#9 2009-12-25 16:06:51

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: Help setting up cron to send me emails

Gumper wrote:

What else do I need to do besides having this program installed?  When I try to add the local account in kmail it is asking me to select a file location. I'm not sure what file to select here. In openSUSE it was already selected for me. Any ideas?

The movemail in Thunderbird and Kmail gets the mail from /var/spool/mail/$USER (or some other spool you specify) and moves it to your mailbox. You should configure Postfix properly to deliver the mail there, some configuration options to consider are: mail_spool_directory and mailbox_command (if you choose to use an external MDA like procmail)... actually the article linked above explains the setup.

Alternative to that is to just pipe the output of interesting cronjobs into mailx, and send it to your existing e-mail account. I'm not sure if mailx in [core] can do it, but mailx-heirloom can certainly, with a ~/.mailrc that goes something like this:

    set smtp=mail.my-isp.com
    set from=user@somehost.tld

... and an example cronjob:

    # Daily backup
    0 6 * * * /usr/local/bin/backup.sh | mailx -s "Backup report" user@mail.tld

Last edited by anrxc (2009-12-25 16:10:23)


You need to install an RTFM interface.

Offline

#10 2009-12-26 00:08:42

Gumper
Member
From: U.S.A.
Registered: 2009-10-26
Posts: 132

Re: Help setting up cron to send me emails

Thanks for all the help! I'll give your suggestions a try and report back if I have any issues.


Ready yourselves, ready yourselves
Let us shine the light of Jesus in the darkest night
Ready yourselves, ready yourselves
May the powers of darkness tremble as our praises rise .... Casting Crowns-Until The Whole World Hears.

Offline

Board footer

Powered by FluxBB