Many log? files on the web server

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
pdv
Posts: 3
Joined: Tue Apr 17, 2012 6:56 pm

Many log? files on the web server

Post 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.
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Re: Many log? files on the web server

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
pdv
Posts: 3
Joined: Tue Apr 17, 2012 6:56 pm

Re: Many log? files on the web server

Post 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.
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Re: Many log? files on the web server

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
pdv
Posts: 3
Joined: Tue Apr 17, 2012 6:56 pm

Re: Many log? files on the web server

Post 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.
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Re: Many log? files on the web server

Post by Klemen »

That's because of the -q (quiet) parameter to wget as suggested in my last reply :)
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply