Terence
Terence

Reputation: 749

CRON JOB ERROR /usr/bin/env: node: No such file or directory

i was getting this error in cron job

 /usr/bin/env: node: No such file or directory

so i did this

 */10 * * * * . $HOME/.bashrc sh /path/to/cronjob.sh

in my cron job

but then it gives me this error

 /etc/cron.daily/man-db:
 /usr/bin/mandb: can't set the locale; make sure $LC_* and $LANG are correct

Upvotes: 0

Views: 5671

Answers (1)

Liviu Jianu
Liviu Jianu

Reputation: 110

When you are doing this directly in the cron entry: . $HOME/.bashrc you are actually asking the user cron to set its environment and most likely it has no Locale defined.

You should set your environment in your script directly just after setting the bash directive:

    #!/bin/bash
    . $HOME/.bashrc
    echo Hello World

It would be better if you configure .bash_profile to load .profile and then load .bashrc

Upvotes: 5

Related Questions