Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Cron and disabling emails for one script only
Date: Tue, 06 Apr 2021 17:43:45
Message-Id: 0c318816-b4ad-3e3f-cbed-057b142a37bd@gmail.com
1 Howdy,
2
3 I set up a hard drive to backup my emails, world file, /etc and a couple
4 other things.  I been doing it manually but finally set up a cron job to
5 run it automatically.  I call it a script but some may laugh at me
6 calling it that.  Anyway, I got cron to run it just fine.  It runs and
7 copies it over just like it should.  I set it to do that each hour. 
8 Thing is, it sends a email every time it does it.  I don't mind a email
9 if there is a error but don't want one if it runs successfully.  This is
10 the cron file I set up.  It's placed in the hourly directory.
11
12
13 #!/bin/bash
14 /root/mail-backup > /dev/null 2>&1 || true
15 # >/dev/null 2>&1
16
17
18 I got a lot of hits doing a google search and the only thing I see is to
19 direct it to /dev/null.  From examples I've seen, this should work.  I
20 then ran across the one currently up there with true in it.  I don't
21 understand that but tried it anyway.  It still sends emails.  I also
22 tried the one commented out below that as well.  Still emails. 
23
24 Keep in mind, I do not want to disable ALL emails, just this one
25 script.  How does one disable emails for this one cron job?  Do I have a
26 typo or putting it in wrong place maybe?  Everything I found shows this
27 should work but obviously I'm doing something wrong.  Again, error
28 emails are fine.  I don't want successful runs tho. 
29
30 Thanks much.
31
32 Dale
33
34 :-)  :-) 

Replies

Subject Author
Re: [gentoo-user] Cron and disabling emails for one script only antlists <antlists@××××××××××××.uk>
Re: [gentoo-user] Cron and disabling emails for one script only Neil Bothwick <neil@××××××××××.uk>
Re: [gentoo-user] Cron and disabling emails for one script only John Covici <covici@××××××××××.com>