user1610719
user1610719

Reputation: 1303

Cron on Ubuntu AWS with Python/Anaconda Virtual Environment

Previously was using Fedora, and I was calling cron jobs using this method, which worked perfectly:

source /home/me/miniconda/bin/activate me_dev; python /home/me/avant_bi/g_parse.py

Now this throw an error in the cron logs:

/bin/sh: 1: source: not found

I've tried switching source for a . to no avail, as I read something I didn't fully understand about Ubuntu cron not working with the source call.

I've also tried

/home/me/miniconda/envs/me_dev/python /home/me/avant_bi/g_parse.py

Which is the location of the python I use when I activate the environment generally, but that seemingly is doing nothing (no logs of it running in cron).

I've tried multiple variations of this to no avail. Any ideas for what to do in this situation?

Upvotes: 0

Views: 95

Answers (1)

Cwissy
Cwissy

Reputation: 2166

default shell on ubuntu is /bin/dash so /bin/sh will be a symlink to that. source is a bash builtin. to run cron jobs as bash put SHELL=/bin/bash in the cron file

Upvotes: 2

Related Questions