1 |
On Tue, 06 Apr 2021 13:43:31 -0400, |
2 |
Dale wrote: |
3 |
> |
4 |
> Howdy, |
5 |
> |
6 |
> I set up a hard drive to backup my emails, world file, /etc and a couple |
7 |
> other things. I been doing it manually but finally set up a cron job to |
8 |
> run it automatically. I call it a script but some may laugh at me |
9 |
> calling it that. Anyway, I got cron to run it just fine. It runs and |
10 |
> copies it over just like it should. I set it to do that each hour. |
11 |
> Thing is, it sends a email every time it does it. I don't mind a email |
12 |
> if there is a error but don't want one if it runs successfully. This is |
13 |
> the cron file I set up. It's placed in the hourly directory. |
14 |
> |
15 |
> |
16 |
> #!/bin/bash |
17 |
> /root/mail-backup > /dev/null 2>&1 || true |
18 |
> # >/dev/null 2>&1 |
19 |
> |
20 |
> |
21 |
> I got a lot of hits doing a google search and the only thing I see is to |
22 |
> direct it to /dev/null. From examples I've seen, this should work. I |
23 |
> then ran across the one currently up there with true in it. I don't |
24 |
> understand that but tried it anyway. It still sends emails. I also |
25 |
> tried the one commented out below that as well. Still emails. |
26 |
> |
27 |
> Keep in mind, I do not want to disable ALL emails, just this one |
28 |
> script. How does one disable emails for this one cron job? Do I have a |
29 |
> typo or putting it in wrong place maybe? Everything I found shows this |
30 |
> should work but obviously I'm doing something wrong. Again, error |
31 |
> emails are fine. I don't want successful runs tho. |
32 |
> |
33 |
> Thanks much. |
34 |
|
35 |
I think you have to do it in your actual backup script or put the |
36 |
whole thing in the hourly directory putting >/dev/null at the end of |
37 |
each rsync command, but leaving off the 2>&1, so you will get error |
38 |
messages. |
39 |
|
40 |
-- |
41 |
Your life is like a penny. You're going to lose it. The question is: |
42 |
How do |
43 |
you spend it? |
44 |
|
45 |
John Covici wb2una |
46 |
covici@××××××××××.com |