I have a crontab entry which runs ones per hour calling a bash script. The content of the script is:
#! /bin/bash # # dig smtp.gmail.com >> digoutput.txt 2>&1 rc=$? [ $rc -ne 0 ] && echo "exitcode dig = $rc"
The output of the cronjob is: /home/xxxxx/bin/script.sh: line 4: 32349 Terminated dig smtp.gmail.com >> digoutput.txt 2>&1 exitcode dig =143
143 means the dig command is terminated by SIGTERM
Any idea?
On Sat, 25 Jun 2022 11:54:21 +0200 Freek de Kruijf freek@opensuse.org wrote:
dig smtp.gmail.com >> digoutput.txt 2>&1
what happens if you run this command by itself in a terminal?
Op zaterdag 25 juni 2022 14:37:21 CEST schreef Dave Howorth:
On Sat, 25 Jun 2022 11:54:21 +0200 Freek de Kruijf freek@opensuse.org wrote:
dig smtp.gmail.com >> digoutput.txt 2>&1
what happens if you run this command by itself in a terminal?
It works as expected, but this only happens occasionally, normally the command works OK. Yesterday it occurred 4 times out of 24 and today it already occurred 4 times out of 16.
It may be important to mention: this is with Leap 15.4 on a Raspberry Pi 4B.
Remember that with cron you need to set the path env as there is no place it is inherited from.
Ken Schneider
On Jun 25, 2022, at 9:25 AM, Freek de Kruijf freek@opensuse.org wrote:
Op zaterdag 25 juni 2022 14:37:21 CEST schreef Dave Howorth:
On Sat, 25 Jun 2022 11:54:21 +0200 Freek de Kruijf freek@opensuse.org wrote:
dig smtp.gmail.com >> digoutput.txt 2>&1
what happens if you run this command by itself in a terminal?
It works as expected, but this only happens occasionally, normally the command works OK. Yesterday it occurred 4 times out of 24 and today it already occurred 4 times out of 16.
It may be important to mention: this is with Leap 15.4 on a Raspberry Pi 4B.
-- fr.gr.
member openSUSE Freek de Kruijf
Freek, et al --
...and then Freek de Kruijf said... % % It works as expected, but this only happens occasionally, normally the % command works OK. Yesterday it occurred 4 times out of 24 and today it % already occurred 4 times out of 16.
That's very odd indeed. It doesn't sound like it's related to runnimg under cron but instead something transient in the system. I was going to suggeat that you strace dig, but i don't think that;s worth it.
% % It may be important to mention: this is with Leap 15.4 on a Raspberry Pi 4B.
I would lean next toward a resource limitation, and although a Pi is awesome :-) perhaps it's struggling. What does top tell you? What's the uptime? Carlos usually has great ideas here :-) You might try adding some debug info into the script to give you a picture of the world each time cron kicks it off. What if you run the command manually oh, say, 1000 times with no waiting?
:-D
Op maandag 27 juni 2022 12:32:03 CEST schreef David T-G:
Freek, et al --
...and then Freek de Kruijf said... % % It works as expected, but this only happens occasionally, normally the % command works OK. Yesterday it occurred 4 times out of 24 and today it % already occurred 4 times out of 16.
That's very odd indeed. It doesn't sound like it's related to runnimg under cron but instead something transient in the system. I was going to suggeat that you strace dig, but i don't think that;s worth it.
% % It may be important to mention: this is with Leap 15.4 on a Raspberry Pi 4B.
I would lean next toward a resource limitation, and although a Pi is awesome :-) perhaps it's struggling. What does top tell you? What's the uptime? Carlos usually has great ideas here :-) You might try adding some debug info into the script to give you a picture of the world each time cron kicks it off. What if you run the command manually oh, say, 1000 times with no waiting?
:-D
Tried it 1000 times, without waiting and a sleep 1. Both reported one issue, respectively on count 450 and 179.
top i shows: top - 16:44:13 up 13 days, 2:02, 1 user, load average: 0.01, 0.05, 0.02 Tasks: 180 total, 1 running, 179 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.2 us, 0.2 sy, 0.0 ni, 99.6 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 7836.246 total, 1192.496 free, 1704.031 used, 4939.719 buff/cache MiB Swap: 8195.996 total, 8194.246 free, 1.750 used. 6051.578 avail Mem
Freek, et al --
...and then Freek de Kruijf said... % % Op maandag 27 juni 2022 12:32:03 CEST schreef David T-G: % > ... % > uptime? Carlos usually has great ideas here :-) You might try adding % > some debug info into the script to give you a picture of the world each % > time cron kicks it off. What if you run the command manually oh, say, % > 1000 times with no waiting? % > % Tried it 1000 times, without waiting and a sleep 1. Both reported one issue, % respectively on count 450 and 179. [snip]
Oho! At least you can rule out cron, which makes things one step simpler. Yay.
Time to turn this back over to the experts. I'm just an out-of-work admin who fumbles around OK :-) But a big branch of the decision tree has just been pruned away, so I can feel like I helped.
:-D
Hi there,
On Mon, 27 Jun 2022, 16:51:55 +0200, David T-G wrote:
Freek, et al --
...and then Freek de Kruijf said... % % Op maandag 27 juni 2022 12:32:03 CEST schreef David T-G: % > ... % > uptime? Carlos usually has great ideas here :-) You might try adding % > some debug info into the script to give you a picture of the world each % > time cron kicks it off. What if you run the command manually oh, say, % > 1000 times with no waiting? % > % Tried it 1000 times, without waiting and a sleep 1. Both reported one issue, % respectively on count 450 and 179. [snip]
Oho! At least you can rule out cron, which makes things one step simpler. Yay.
Time to turn this back over to the experts. I'm just an out-of-work admin who fumbles around OK :-) But a big branch of the decision tree has just been pruned away, so I can feel like I helped.
this smells like what I have seen every once in a while when resolving host names with an IPv6 address. At least I don't have IPv6 available here, it ended up with error messages; this mostly happened with ntpd.
@Freek: if you don't usually use IPv6 (or if you even can't), can you add a "-4" option to your "dig smtp.gmail.com" command? It helped for my case.
HTH, cheers.
l8er manfred