Cannot run the replication.sh script by crontab inside docker container

I encounter a problem that I can run successfully the replication.sh script (full path: /usr/local/bin/replication.sh) by a manual way (by accessing into musicbrainz docker container, and execute it). But when I set crontab for this script, it throws this error when executing (I get this error from file slave.log):

Can’t locate aliased.pm in @INC (you may need to install the aliased module) (@INC contains: /musicbrainz-server/admin/replication/…/…/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /musicbrainz-server/admin/replication/…/…/lib/MusicBrainz/Server/DatabaseConnectionFactory.pm line 6.
BEGIN failed–compilation aborted at /musicbrainz-server/admin/replication/…/…/lib/MusicBrainz/Server/DatabaseConnectionFactory.pm line 6.
Compilation failed in require at /musicbrainz-server/admin/replication/…/…/lib/DBDefs.pm line 31.
BEGIN failed–compilation aborted at /musicbrainz-server/admin/replication/…/…/lib/DBDefs.pm line 31.
Compilation failed in require at ./admin/replication/LoadReplicationChanges line 32.
BEGIN failed–compilation aborted at ./admin/replication/LoadReplicationChanges line 32.

based on the error message, I tried to install JSON by command: cpan JSON, but the error is still throwed

Anyone can help me?

I found an alter way to re-implement the replication.sh script.
Maybe the latest replicate.sh script has a problem that cannot run properly, including the command “set -e” which imports all environment variables before running doesn’t work. I have to implement the script based on the old version of script. This is my current script (I named it as replication-new.sh):

#!/bin/bash

eval $( /usr/bin/perl -Mlocal::lib )
export POSTGRES_USER=[YOUR_DB_USERNAME]
export POSTGRES_PASSWORD=[YOUR_DB_PASSWORD]
export MUSICBRAINZ_STANDALONE_SERVER=0
export MUSICBRAINZ_WEB_SERVER_HOST=localhost
export MUSICBRAINZ_WEB_SERVER_PORT=5000
export MUSICBRAINZ_DB_SCHEMA_SEQUENCE=26
/bin/bash /musicbrainz-server/admin/cron/slave.sh

you can change all above necessary environment variables to a correct value in your system
Finally, re-define a current crontab job by using command: crontab -e , then change the cron job expression:

0 3 * * * /usr/local/bin/replication-new.sh

Close the crontab window by press: Esc → type :wq to close
That’s it. Hopes it help all you who are facing the same problem