Cron job does NOT get the environment variables set in .bashrc

后端 未结 3 1612
误落风尘
误落风尘 2020-12-08 10:23

Here is my cron job:

plee@dragon:~$ crontab -l
* * * * * /bin/bash -l -c \'source ~/.bashrc; echo $EDITOR > /tmp/cronjob.test\'

and insi

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 10:58

    I just tried a file .env_setup_rc file with only one line export EDITOR=vim, surprisingly it's working.

    So I guess there is something in .bashrc conflicting with the cron job bash command.

提交回复
热议问题