O
O
O_Nayre2017-07-04 05:46:43
linux
O_Nayre, 2017-07-04 05:46:43

How to set up Cron message sending?

I've been fighting with the server and Google for a couple of hours now.
Centos 6. Postfix system. Cron via duplicity and dupli.
The scripts are responsible for backing up the database and files and throwing them into the cloud. At this stage, everything works.
And outputs to the console and log

Start duply v1.6.0, time is 2017-07-04 04:31:53.
Using profile '/etc/duply/main'.
Using installed duplicity version 0.6.26, python 2.6.6, gpg 2.0.14 (Home: ~/.gnupg), awk 'GNU Awk 3.1.7', bash '4.1.2(2)-release (x86_64-redhat-linux-gnu)'.
Signing disabled. Not GPG_KEY entries in config.
Test - Encryption with passphrase (OK)
Test - Decryption with passphrase (OK)
Test - Compare (OK)
Cleanup - Delete '/tmp/duply.3699.1499131913_*'(OK)
--- Start running command PRE at 04:31:54.075 ---
Skipping n/a script '/etc/duply/main/pre'.
--- Finished state OK at 04:31:54.088 - Runtime 00:00:00.012 ---
--- Start running command BKP at 04:31:54.097 ---
Duplicity 0.6 series is being deprecated:
See http://www.nongnu.org/duplicity/
Reading globbing filelist /etc/duply/main/exclude
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Fri Jun 30 07:54:33 2017
--------------[ Backup Statistics ]--------------
StartTime 1499131915.59 (Tue Jul  4 04:31:55 2017)
EndTime 1499132049.03 (Tue Jul  4 04:34:09 2017)
ElapsedTime 133.45 (2 minutes 13.45 seconds)
SourceFiles 199161
SourceFileSize 14418048020 (13.4 GB)
NewFiles 98
NewFileSize 110786 (108 KB)
DeletedFiles 0
ChangedFiles 2
ChangedFileSize 179197 (175 KB)
ChangedDeltaSize 0 (0 bytes)
DeltaEntries 100
RawDeltaSize 199707 (195 KB)
TotalDestinationSizeChange 63614 (62.1 KB)
Errors 0
-------------------------------------------------
--- Finished state OK at 04:34:11.032 - Runtime 00:02:16.934 ---
--- Start running command POST at 04:34:11.042 ---
Skipping n/a script '/etc/duply/main/post'.
--- Finished state OK at 04:34:11.055 - Runtime 00:00:00.012 ---

In crontab I tried to prescribe and
[email protected]
and
MAILTO=rootc aliases in /etc/aliases root: [email protected]
commands of the form
echo "Test mail from postfix" | mail -s "Test Postfix" [email protected]

or
еcho test mail | mail -s "test" root && sudo tail -f /var/log/maillog

successfully send any gibberish
log /var/log/mailogdoes not contain anything specific
Jul  4 05:31:01 root postfix/pickup[2016]: DED423F4BF: uid=0 from=<root>
Jul  4 05:31:01 root postfix/cleanup[2847]: DED423F4BF: message-id=<[email protected]>
Jul  4 05:31:01 root postfix/qmgr[2017]: DED423F4BF: from=<[email protected]>, size=500, nrcpt=1 (queue active)
Jul  4 05:31:01 root postfix/cleanup[2847]: E92123F4B9: message-id=<[email protected]>
Jul  4 05:31:01 root postfix/qmgr[2017]: E92123F4B9: from=<[email protected]>, size=645, nrcpt=1 (queue active)
Jul  4 05:31:01 root postfix/local[2849]: DED423F4BF: to=<[email protected]>, orig_to=<root>, relay=local, delay=0.07, delays=0.04/0.02/0/$
Jul  4 05:31:01 root postfix/qmgr[2017]: DED423F4BF: removed
Jul  4 05:31:03 root postfix/smtp[2850]: E92123F4B9: to=<[email protected]>, orig_to=<root>, relay=mx.yandex.net[2a02:6b8::89]:25, delay=1.1$
Jul  4 05:31:03 root postfix/qmgr[2017]: E92123F4B9: removed

cron log
Jul  4 04:32:01 root anacron[2877]: Job `cron.daily' started
Jul  4 04:32:01 root run-parts(/etc/cron.daily)[3910]: starting cups
Jul  4 04:32:01 root run-parts(/etc/cron.daily)[3918]: finished cups
Jul  4 04:32:01 root run-parts(/etc/cron.daily)[3910]: starting logrotate
Jul  4 04:32:01 root run-parts(/etc/cron.daily)[3925]: finished logrotate
Jul  4 04:32:01 root run-parts(/etc/cron.daily)[3910]: starting makewhatis.cron
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[4083]: finished makewhatis.cron
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[3910]: starting mlocate.cron
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[4094]: finished mlocate.cron
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[3910]: starting prelink
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[4106]: finished prelink
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[3910]: starting readahead.cron
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[4118]: finished readahead.cron
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[3910]: starting tmpwatch
Jul  4 04:32:02 root run-parts(/etc/cron.daily)[4126]: finished tmpwatch
Jul  4 04:32:02 root anacron[2877]: Job `cron.daily' terminated
Jul  4 04:32:02 root anacron[2877]: Normal exit (1 job run)

The question already causes twitching of the cheek (I dance with a tambourine for 4 hours). Why is the message not being sent after the backup?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Fedoseev, 2017-07-04
@martin74ua

how is the command written in cron?

E
Eugene, 2020-06-23
@zeond

For CentOS, in order for you to send stdout and stderr from services and applications, in addition to editing /etc/aliases , you need to
install something like postfix, exim, etc. The newaliases command comes with them.
Total:
1. Edited /etc/aliases, indicated mail there
2. Charged the command: newaliases

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question