2

My Synology NAS just upgraded and a lot of things have broken.

My cronjob that calls Python3 keeps saying /bin/sh: python3: command not found but /bin/sh exists and I am able to call Python3 from the commandline.

Why am I getting this error?

4
  • python3 != Python3 ? Not sure about how cronjob get the PATH env var but it might have something to do with it (and where python3/Python3 is)
    – Tom Yan
    Mar 24, 2016 at 16:17
  • Sorry that was just a case error. They are both python3. I had to manually add path of python3 to my profile
    – Bijan
    Mar 24, 2016 at 16:22
  • You mean some profile in your $HOME? Then I suppose you need to at least add it to some system-wide one (e.g. /etc/profile?)
    – Tom Yan
    Mar 24, 2016 at 16:31
  • It already is in /etc/profile
    – Bijan
    Mar 24, 2016 at 16:34

2 Answers 2

3

I believe cron runs without the benefit of the path being defined.

Use the full path to python3 as well as the script you're executing and it should work.

0

An alternative solution to @trel's solution is to either add the PATH variable at top of crontab file

PATH=$PATH:/volume1/@appstore/python3/bin

or by adding source /path/to/profile && [Rest of cronjob command here]

In my case for Synology, my profile was /etc/profile

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .