[solution] Cronjob does not respect your bashrc or other library profile settings


min read


If you need a cronjob and use the exact code and user as CLI .. you may find that libraries cannot be found.

It turns out that even when using the same user on which CLI calls work, the ld_library_path is NOT read or applied.

So when using a bash shell script, make sure you have your environment paths in order before actually firing your line(s) with code.

In my case:

cron bash call to this file:


# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc

# User specific aliases and functions
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/home/dev/all_libraries:/opt/MATLAB/MATLAB_Compiler_Runtime/v714 ;

# fire all code here[/code:1:2a24a9b68f]

Leave a Reply

Your email address will not be published. Required fields are marked *