0

I have set my cron job to be executed every 15 minutes. my cron job is */15 * * * * /usr/bin/python3.6 /home/ubuntu/main.py >> /tmp/file

Above job will execute every 15 minutes and send the emails. But I receive two emails at one time. so I checked the logs. I found that It was executed twice at a time. in the logs, you could see the highlighted one executed at 05:17 but there was a job earlier executed at 05:15 the time gap is 2 minutes. but the time gap I set was 15 minutes. so Could I get the reason behind it?

here is my log file

Oct  1 23:15:51 escnn CRON[10086]: (CRON) info (No MTA installed, discarding output)
Oct  1 23:17:01 escnn CRON[10164]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct  1 23:30:01 escnn CRON[10240]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  1 23:30:54 escnn CRON[10239]: (CRON) info (No MTA installed, discarding output)
Oct  1 23:45:01 escnn CRON[10318]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  1 23:45:54 escnn CRON[10317]: (CRON) info (No MTA installed, discarding output)
Oct  2 00:00:01 escnn CRON[10396]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 00:00:54 escnn CRON[10395]: (CRON) info (No MTA installed, discarding output)
Oct  2 00:15:01 escnn CRON[10474]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 00:15:53 escnn CRON[10473]: (CRON) info (No MTA installed, discarding output)
Oct  2 00:17:01 escnn CRON[10552]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct  2 00:30:01 escnn CRON[10556]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 00:31:06 escnn CRON[10555]: (CRON) info (No MTA installed, discarding output)
Oct  2 00:45:02 escnn CRON[10634]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 00:46:03 escnn CRON[10633]: (CRON) info (No MTA installed, discarding output)
Oct  2 01:00:01 escnn CRON[10702]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 01:00:55 escnn CRON[10701]: (CRON) info (No MTA installed, discarding output)
Oct  2 01:15:01 escnn CRON[10781]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 01:15:55 escnn CRON[10780]: (CRON) info (No MTA installed, discarding output)
Oct  2 01:17:01 escnn CRON[10858]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct  2 01:30:01 escnn CRON[10862]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 01:31:08 escnn CRON[10861]: (CRON) info (No MTA installed, discarding output)
Oct  2 01:45:01 escnn CRON[10944]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 01:46:03 escnn CRON[10943]: (CRON) info (No MTA installed, discarding output)
Oct  2 02:00:01 escnn CRON[11022]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 02:00:51 escnn CRON[11021]: (CRON) info (No MTA installed, discarding output)
Oct  2 02:15:01 escnn CRON[11101]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 02:16:11 escnn CRON[11100]: (CRON) info (No MTA installed, discarding output)
Oct  2 02:17:01 escnn CRON[11179]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct  2 02:30:01 escnn CRON[11183]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 02:31:07 escnn CRON[11182]: (CRON) info (No MTA installed, discarding output)
Oct  2 02:45:01 escnn CRON[11262]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 02:45:56 escnn CRON[11261]: (CRON) info (No MTA installed, discarding output)
Oct  2 03:00:01 escnn CRON[11341]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 03:00:56 escnn CRON[11340]: (CRON) info (No MTA installed, discarding output)
Oct  2 03:15:01 escnn CRON[11419]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 03:15:51 escnn CRON[11418]: (CRON) info (No MTA installed, discarding output)
Oct  2 03:17:01 escnn CRON[11485]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct  2 03:30:01 escnn CRON[11489]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 03:30:54 escnn CRON[11488]: (CRON) info (No MTA installed, discarding output)
Oct  2 03:45:01 escnn CRON[11567]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 03:45:52 escnn CRON[11566]: (CRON) info (No MTA installed, discarding output)
Oct  2 04:00:01 escnn CRON[11645]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 04:01:12 escnn CRON[11644]: (CRON) info (No MTA installed, discarding output)
Oct  2 04:15:01 escnn CRON[11723]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 04:16:13 escnn CRON[11722]: (CRON) info (No MTA installed, discarding output)
Oct  2 04:17:01 escnn CRON[11801]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct  2 04:30:01 escnn CRON[11805]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 04:32:04 escnn CRON[11804]: (CRON) info (No MTA installed, discarding output)
Oct  2 04:45:01 escnn CRON[11883]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 04:46:11 escnn CRON[11882]: (CRON) info (No MTA installed, discarding output)
Oct  2 05:00:01 escnn CRON[11961]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 05:01:00 escnn CRON[11960]: (CRON) info (No MTA installed, discarding output)
Oct  2 05:15:01 escnn CRON[12159]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 05:17:01 escnn CRON[12225]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct  2 05:17:27 escnn CRON[12158]: (CRON) info (No MTA installed, discarding output)
Oct  2 05:30:01 escnn CRON[12240]: (ubuntu) CMD (/usr/bin/python3.6 /home/ubuntu/Deploy/LSTM_Attention_IMDB_New_open.py  >> /tmp/file)
Oct  2 05:31:05 escnn CRON[12239]: (CRON) info (No MTA installed, discarding output)

enter image description here

4
  • Welcome to Ask Ubuntu! Haven’t you put your job to /etc/cron.hourly, too? This is the only thing that appears at the time x:17. Moreover, it’s the time when hourly jobs are executed by default according to /etc/crontab.
    – Melebius
    Oct 2, 2018 at 6:48
  • @Melebius Thanks. As far as I checked There were no scripts or files inside that folder. Oct 2, 2018 at 6:55
  • 1
    I don't get it. When I remove the noise from your logfile with grep -v -F '(CRON)' log.txt | grep -v -F '(root)' then I only see your job every 15 minutes (..., 04:30:01, 04:45:01, 05:00:01, 05:15:01, 05:30:01). At 05:17:01 cron simply says that it runs the cron.hourly jobs (as it does every hour at xx:17). I would guess your Python script simply sends two emails. Please verify that.
    – PerlDuck
    Oct 2, 2018 at 9:26
  • By the way: this is a perfect example of why posting logfiles as text is far better than posting screenshots of them because I could not have grepped in the screenshot. Thank you.
    – PerlDuck
    Oct 3, 2018 at 11:09

0

You must log in to answer this question.

Browse other questions tagged .