CRON and Crontab setup properly

Keywords: Moodle - Google Cloud Platform - Technical issue - Other
bnsupport ID: c559e986-95fe-8e7a-23b7-404d8473c32e
Description:
Bitnami Support ticket c559e986-95fe-8e7a-23b7-404d8473c32e

Hi need to some help setting up the cron and crontab, when I run sudo and the command

/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php > /dev/null

the cron job work, but when I try to setup the crontab with the “Self-Contained Bitnami Installation” in this guide:
https://docs.bitnami.com/google/apps/moodle/configuration/install-cron/

the cronjob doesnt execute by itself.

Actually on my crontab i got this:

*/1 * * * * sudo su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php > /dev/null"

Any help you can provide is much apreciated.

Update the situation continues, just find out on the “moodle.cron.log” that appear this message

/opt/bitnami/php/bin/php.bin: error while loading shared libraries: libzip.so.5: cannot open shared object file: No such file or directory

i´m trying the solution in this post below but keep getting same situation

Any help you can provide is apreciated.

Hi @acaceres,

Can you tell me the output of this command:

sudo su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php"

Regards.
Michiel

Hi, Just tried the command you mention, and get this output:

/opt/bitnami/php/bin/php.bin: error while loading shared libraries: libzip.so.5:                                                                              cannot open shared object file: No such file or directory

Hi @acaceres,

Can you try installing the library:

sudo apt-get update
sudo apt-get install libzip-dev 

Regards,
Michiel

Hi just tried the command you mention and install the “libzip-dev” library and rerrun the

sudo su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php"

but keep getting the message

/opt/bitnami/php/bin/php.bin: error while loading shared libraries: libzip.so.5:                                                                              cannot open shared object file: No such file or directory

some thing I notice is that when i run fisrt

sudo su

then run

/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php

it run properly and the moodle instalation take notice.

Hi @acaceres,

Could you try the following?

sudo su root -s /bin/sh -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php"

Regards,
Michiel

Hi, I´m glad to inform that i tried this code

sudo su root -s /bin/sh -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php"

it works properly then just run:

sudo crontab -e

and replace what was there for

sudo su root -s /bin/sh -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php"

and it works properly, thanks fo all the help provided.

Correction: this was what i input on the sudo crontab -e command

*/1 * * * * sudo su root -s /bin/sh -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/moodle/htdocs/admin/cli/cron.php > /dev/null"

Thanks for all the help provided, solving this situation.

1 Like

Hi @acaceres,

I’m glad to hear you’ve solved the issue. Thanks for sharing it. :smile:

Regards,
Michiel

Thanks for the feedback. We have also updated the page at https://docs.bitnami.com/google/apps/moodle/configuration/install-cron/ with this information.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.