John Covici wrote:
> On Tue, 06 Apr 2021 13:43:31 -0400,
> Dale wrote:
>> Howdy,
>>
>> I set up a hard drive to backup my emails, world file, /etc and a couple
>> other things.  I been doing it manually but finally set up a cron job to
>> run it automatically.  I call it a script but some may laugh at me
>> calling it that.  Anyway, I got cron to run it just fine.  It runs and
>> copies it over just like it should.  I set it to do that each hour. 
>> Thing is, it sends a email every time it does it.  I don't mind a email
>> if there is a error but don't want one if it runs successfully.  This is
>> the cron file I set up.  It's placed in the hourly directory.
>>
>>
>> #!/bin/bash
>> /root/mail-backup > /dev/null 2>&1 || true
>> # >/dev/null 2>&1
>>
>>
>> I got a lot of hits doing a google search and the only thing I see is to
>> direct it to /dev/null.  From examples I've seen, this should work.  I
>> then ran across the one currently up there with true in it.  I don't
>> understand that but tried it anyway.  It still sends emails.  I also
>> tried the one commented out below that as well.  Still emails. 
>>
>> Keep in mind, I do not want to disable ALL emails, just this one
>> script.  How does one disable emails for this one cron job?  Do I have a
>> typo or putting it in wrong place maybe?  Everything I found shows this
>> should work but obviously I'm doing something wrong.  Again, error
>> emails are fine.  I don't want successful runs tho. 
>>
>> Thanks much.
> I think you have to do it in your actual backup script or put the
> whole thing in the hourly directory putting >/dev/null at the end of
> each rsync command, but leaving off the 2>&1, so you will get error
> messages.
>


This seems to be working.  Since I added the null bit to the script
itself, it hasn't sent a email.  I don't know if it will if it fails but
I still have weekly backups as well. 

It seems I had the right option, just put it in the wrong place.  I
figured it would be something like that. 

Thanks to all.

Dale

:-)  :-) 

Reply via email to