Page 1 of 1

Many log? files on the web server

Posted: Mon Mar 04, 2024 12:37 pm
by pdv
Hesk leaves a kind of log file on the web server that pertains to the IMAP part. Hesk retrieves email from an Office 365 environment, and this all works perfectly.

Each time, a file is created on the web server with the name: hesk_imap.php_key=MY_SECRET_KEY.100051.

It appears that these files are generated by the following script: MY_DOMAIN > inc > mail > hesk_imap.php. (71K by now)

The content of the file is the same every time: #!/usr/bin/php -q
I cannot find anything unusual in the script, and I wouldn’t know what could be causing this. Does anyone have an idea? 🤔

With de debug mode on the result from the email fetch script is:

Code: Select all

#!/usr/bin/php -q
Connected to the IMAP server "outlook.office365.com:993".
No unread messages found.
Disconnected from the IMAP server.

Re: Many log? files on the web server

Posted: Mon Mar 04, 2024 12:42 pm
by Klemen
This is not created by Hesk, but is most likely a Cron job log.

Add this to the end of your cron job to suppress cron logs:

Code: Select all

 >/dev/null 2>&1
For example:

Code: Select all

/usr/bin/php -q /path_to_hesk/inc/mail/hesk_pop3.php >/dev/null 2>&1

Re: Many log? files on the web server

Posted: Mon Mar 04, 2024 12:49 pm
by pdv
The cron job used is:

Code: Select all

/usr/bin/flock -n ~/cron.lock.wjpjwanu wget https://support.MY_DOMAIN.nl/inc/mail/hesk_imap.php?key=MY_SECRET >/dev/null 2>&1
so it seems to be correct.

What does

Code: Select all

#!/usr/bin/php -q
mean above the hesk_imap.php

When i remove that code above the script, de log file is empty.

Re: Many log? files on the web server

Posted: Mon Mar 04, 2024 2:55 pm
by Klemen
The first line is the shebang (hashbang) line: https://electrictoolbox.com/php-shebang ... t=cmp-true

It's needed sometimes when run over command line on Linux servers.

You are not running it over the command line so it can be removed, but using wget so you fetch it over a web browser.

You may as well try running it directly as I showed instead of using wget, but both will work.

You may want to run wget in the "quiet" mode to avoid output.

Re: Many log? files on the web server

Posted: Tue Mar 05, 2024 7:24 am
by pdv
Hi Klemen,

Thanks for your answer.

Yesterday, based on this site: https://tecadmin.net/disable-crontab-ou ... cron%20job

I changed the cron to:

Code: Select all

/usr/bin/flock -n ~/cron.lock.wjpjwanu wget -q -O /dev/null https://MY_DOMAIN/inc/mail/hesk_imap.php?key=SECRET
This resulted in a working helpdesk and no more log files on the server.
This morning I checked the server again and there are no more logs.

So it seems that there is a difference in the creation of the cron jobs and how the server handles them.

Re: Many log? files on the web server

Posted: Tue Mar 05, 2024 7:44 am
by Klemen
That's because of the -q (quiet) parameter to wget as suggested in my last reply :)