0

I have this crontab to run the bash script predictions.sh at a certain time every day. The script does not run in the crontab, but it runs on the ubuntu command line. I am using AWS Ubuntu 16.04.5.

#!/bin/sh -x
SHELL=/bin/bash
PATH=~/bin:~/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin
LANG=en_US.UTF-8
51 14 * * * ./predictions.sh

The bash script itself runs a python file after activating a python environment 'dateprep':

source dataprep/bin/activate
cd dataprep
python datafiles.py

Would any one know how to get the crontab to work? Thank you

sunday
  • 31
  • 1
  • The `.` is the current directory - crontab is not running from where you expect. Put only full paths in the crontab. – kabanus Feb 12 '20 at 07:06
  • The shebang line is not even wrong; the file contains a `cron` schedule, not a shell script. – tripleee Feb 12 '20 at 07:10
  • Your Python script should not typically be inside the virtual environment; the virtual environment should contain things which aren't yours. – tripleee Feb 12 '20 at 07:11

0 Answers0