Einen Überblick über das Administrationstool KeyHelp der Keyweb AG und dessen Download gibt es auf https://www.keyhelp.de

Dieses Forum soll es interessierten Benutzern ermöglichen, sich über KeyHelp auszutauschen und Hilfe bei Problemen zu finden.

Сron email notification [SOLVED]  [SOLVED]

You found a bug? Please tell us about.
Antworten
majorboobage
Beiträge: 31
Registriert: Do 26. Jul 2018, 08:51

Сron email notification [SOLVED]

Beitrag von majorboobage » Mo 20. Apr 2020, 11:02

Here's the thing.

I am using goaccess with cron:

Code: Alles auswählen

/usr/local/bin/goaccess -p /usr/local/etc/goaccess/goaccess.conf -a - /home/users/USERNAME/logs/access.log -o  /home/users/USERNAME/www/mysite.com/access.html
Bild

Notification: On Errors

As you can see, the task completed without errors (Success).
But each time, after completing the task, a letter arrives.
Bild

So, if the operation is completed successfully, why does the letter come? :?
Zuletzt geändert von majorboobage am Mo 20. Apr 2020, 18:06, insgesamt 1-mal geändert.
Benutzeravatar
Alexander
Keyweb AG
Beiträge: 1270
Registriert: Mi 20. Jan 2016, 02:23

Re: Сron email notification (probably a bug)  [SOLVED]

Beitrag von Alexander » Mo 20. Apr 2020, 12:33

Hello,

it's seams not a bug, at least from the KeyHelp perspective.

The reason you receive the message is, that the goaccess script seams to writes its output ("Parsing... [258] [0/s]....") not into the normal "stdout" (Standard Output Stream) instead to the "stderr" (Standard Error Stream).
If the cron daemon, responsible for executing cron jobs, detects a non empty "stderr" it considered it as an unsuccessful execution of the script, even if the return code of the script was 0 (which means success).

For fixing this behavior, you can redirect the stderr stream of the goaccess script to the stdout stream by appending " 2>&1" to the command within KeyHelp (without the quotation marks of course).

===

For verifying, my above assumption is correct, please have a look into the crontab config file via "crontab -u <NAME_OF_THE_KEYHELP_USER> -l".
Right now, the command should look like:

Code: Alles auswählen

[...] /usr/local/bin/goaccess -p /usr/local/etc/goaccess/goaccess.conf -a - /home/users/USERNAME/logs/access.log -o  /home/users/USERNAME/www/mysite.com/access.html > /dev/null
After you have done the fix mentioned above, it should look like:

Code: Alles auswählen

[...] /usr/local/bin/goaccess -p /usr/local/etc/goaccess/goaccess.conf -a - /home/users/USERNAME/logs/access.log -o  /home/users/USERNAME/www/mysite.com/access.html 2>&1 > /dev/null
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
majorboobage
Beiträge: 31
Registriert: Do 26. Jul 2018, 08:51

Re: Сron email notification [SOLVED]

Beitrag von majorboobage » Mo 20. Apr 2020, 18:05

Hi.

it worked! thank you very much Alexander!

p.s yes, looks like it is old bug/feature :? https://github.com/allinurl/goaccess/issues/467
Antworten

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast