0

I installed a python package which running in shell, like:

 $python-package -input 1      

I create a run.sh file to run it as follow

python-package -input 1 

(Here, python-package represents my installed python package.)

I can run this run.sh file correctly in the shell, but if I run it by crontab -e

0 0 * * * /data/project/run.sh

An error raises,

/data/project/run.sh: line 1: python-package: command not found
rosefun
  • 1,797
  • 1
  • 21
  • 33
  • Try adding the full path to `python-package`, as the OS user running the crontab might not have `python-package` in `$PATH` – richyen Nov 30 '20 at 04:32
  • The full path of `python-package` seems a directory. – rosefun Nov 30 '20 at 04:48
  • See the **Common Problems** section of the [crontab-tag-info page](https://stackoverflow.com/tags/cron/info). Good luck. – shellter Nov 30 '20 at 04:51

1 Answers1

0

In your shell

$ python-package -input 1
$ which python-package
/path/to/python-package

Then use

/path/to/python-package -input 1

in run.sh

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134