How do I know if tasks have been completed / performed? - crontab

I have fulfilled the proposal in this matter.

since I use Django, I installed a script to store the date and time for each script run in db, but there is no record in the database yet.


Is there any way to find out, besides typing "above" and searching through?

+3
source share
3 answers

First, I would probably configure cron to send any output using MAILTO:

In / etc / crontab:

MAILTO=username

Secondly, I usually add something to my script, which (almost) cannot fail, for example:

#!/bin/sh
echo "$0 ran on `date +%c`" >> /tmp/crontab_test.log

# ... rest of program

python script cron, - - script.

+5

sendmail, '/etc/aliases'

root: your_name@domain.com

, :

sudo newaliases

Cron . crontab.

, , (, , ), , , cronjob , .

!

+2

cron cron syslog, /etc/syslog.conf.

# Log cron stuff 
cron.*                                                  /var/log/cron.log 

This should write a message to /var/log/cron.log every time the job runs.

+1
source

Source: https://habr.com/ru/post/1735149/


All Articles