LibreBooking / app

Repository for the last open source version of Booked Scheduler. The "develop" branch contains the most current working code of the project and should be considered beta. The "master" branch is the most current stable release of BookedScheduler. Please read doc/README.md for further details.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

event reminders: call cronjob with wget/curl?

guilegatan opened this issue · comments

We want to use the event reminders, but that requires the cronjob to run regularly.

Our LibreBooking installation is installed on some OpenShift container servers from our central IT.
I can't use the suggested solution for cron, because the direct path to of the LibreBooking installation is not available to me and and php is not running on the container itself.
I created a symbolic link from ./Jobs/sendreminders.php to the Web directory and tried calling it via browser, wget or curl, without success.

Is there any other way of calling the cronjob, without using the proposed php -f /path-to-LibreBooking/Jobs/sendreminders.php method?

Hi @guilegatan ,

I suppose your IT is running librebooking inside a docker container.

If that is the case, could you ask which docker image was used to create the container? In case the image was built (ie. not pulled from a public registry), could you ask how it was built (usually via a Dockerfile).

Yes, its a container (Docker or other, I don't know). But the container only contains is an empty html-folder where I installed LibreBooking myself. MySQL is situated on its own container. And PHP is obviously installed somewhere else alltogether.

Therefore I would prefer a solution where I could call the sendreminders.php somehow via wget/curl if possible

@guilegatan, out of curiosity, did you consider the usage of the published librebooking/librebooking:2.8.6.1 docker image? This image is based on php-apache and thus contains the php binary you need...

No, I don't have any access to the container system used by our IT. As said, its based on OpenShift, but thats all I know about it. I can't even tell if they use Docker images or something different?

All I can do is order a new (empty) "webspace" and get access to a new html-folder where I can put files.

OK. My understanding is that your IT:

  • provided you with a "web space" where you could upload the librebooking files. Actually, this looks like a directory/docker volume
  • runs a web container whose base image must be similar to the php:apache image (ie. it contains the apache and php binaries). Your "web space" is mounted to this web container so that the content can be served by this container.

This means that you have no ways to run a crown job against the apache/php container. Only your IT would have this possibility. I would recommend you check with your IT team.

Ok, thank you for the verification! I will contact our central IT about this. Perhaps they can provide a solution.

Actually, is there a reason why the sendreminders.php can not be called by browser/wget/curl? As its not-interactive, I thought the danger for abuse minimal. But perhaps I am wrong?

Central IT got back to me and provided a solution. Now I have access to php and can call the sendreminders.php file. But strangely I get these errors:
/usr/bin/php -f /var/www/html/Jobs/sendreminders.php
PHP Warning: Undefined array key "HTTPS" in /var/www/html/lib/Server/Server.php on line 254
PHP Warning: Undefined array key "HTTPS" in /var/www/html/lib/Server/Server.php on line 254
PHP Warning: ini_set(): Session ini settings cannot be changed when a session is active in /var/www/html/lib/Server/Server.php on line 53
PHP Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in /var/www/html/lib/Server/Server.php on line 54
PHP Warning: Undefined array key "HTTPS" in /var/www/html/lib/Server/Server.php on line 254
PHP Warning: ini_set(): Session ini settings cannot be changed when a session is active in /var/www/html/lib/Server/Server.php on line 53
PHP Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in /var/www/html/lib/Server/Server.php on line 54
PHP Warning: Undefined array key "HTTPS" in /var/www/html/lib/Server/Server.php on line 254
PHP Warning: ini_set(): Session ini settings cannot be changed when a session is active in /var/www/html/lib/Server/Server.php on line 53
PHP Warning: session_set_cookie_params(): Session cookie parameters cannot be changed when a session is active in /var/www/html/lib/Server/Server.php on line 54

I also tested it on a development machine where I have a LAMP server running, and there it does not throw any errors.
Any suggestions?
Thanks in advance!

@guilegatan,

the script sendreminders.php must be executed on the host where your LAMp server is located. This is why it works on your development machine.

Can you give us more details on the "solution" that your IT team gave you? I have the feeling that they gave you access to the webspace so that you can invoke the sendreminders.php from your PC. If that is the case, then this solution cannot work.

They gave me access to a web-UI of OpenShift with a terminal window. Everything is running in the webbrowser.
I'll attach a screenshot.
I also checked "CronJobs" in the lefthand menu, which is emtpy with no way of adding anything.
Zwischenablage02

@guilegatan

I only see php Warnings. Thus, the script is maybe working...
Could you please set the librebooking function on?

From the OpenShift terminal:

  1. Create the librebooking log folder: mkdir /var/log/librebooking
  2. Create the librebooking log file: touch /var/log/librebooking/app.log
  3. Change the ownership: chown -R www-data:www-data /var/log/librebooking

Login to your librebooking web site site as the administrator and open the application configuration:

  1. Set the logging folder: /var/log/librebooking
  2. Set the logging level: debug

Run sendreminders.php again, then please share the relevant content of your file /var/log/librebooking/app.log

Sadly I don't have permission in /var/log
I set the log folder+file to /tmp/app.log

the relevant part from the logfile looks fine although the errors remain:
[2023-11-28T09:15:46.248631+01:00] app.INFO: [User= ()] Running sendreminders.php [File=/var/www/html/Jobs/sendreminders.php,Line=14]
[2023-11-28T09:15:46.263680+01:00] app.INFO: [User= ()] Found 0 start reminders [File=/var/www/html/Jobs/sendreminders.php,Line=28]
[2023-11-28T09:15:46.271568+01:00] app.INFO: [User= ()] Found 0 end reminders [File=/var/www/html/Jobs/sendreminders.php,Line=34]
[2023-11-28T09:15:46.271721+01:00] app.INFO: [User= ()] Finished running sendreminders.php

I will create a reminder and run the script by hand a couple of times. Lets see if the reminder works. If so, I can further work on the cronjob.
Thank you for your help so far, @colisee !!

Horray! Actually - despite the php-errors - the sendreminders.php script works! Just cronjobs don't work (yet), but I hope I will figure that out somehow eventually.
Sadly crontab -e does not work on the machine either. And using the cron options central IT provides does not result in a working cronjob...

@guilegatan , now that you saw that the sendreminders.php script works in your Openshift environment, could you please close this issue, for I doubt I will be able to help you with cronjobs under OpenShift. This is something you will have to handle with your IT team.