Cron fails with the message Superset: command not found

Question:

I’ve installed Superset following the installation guide in the apache superset web page, for Python 3.7.

Even though I can manually start the server, when I’m trying to script the startup steps and cron them, it fails.

The output of the execution is the following:

superset: command not found

I’ve read the replies of this topic but nothing applies to this case.
I’m not using virtualenv for the installation.

These are the output of the which commands:

ec2-user@Superset-STAGE /var/spool/mail$which python3
/usr/bin/python3 

ec2-user@Superset-STAGE /var/spool/mail$which superset
~/.local/bin/superset

ec2-user@Superset-STAGE /var/spool/mail$sudo superset
sudo: superset: command not found

Would you please guide me on how to have my script working without failure? Script looks like below.

superset init
wait
superset runserver -d
Asked By: Nicolas Soria

||

Answers:

Cron runs as root, which means its home directory is /root rather than /home/ec2-user as you expect. This means that it will not be able to find /home/ec2-user/.local/bin/superset because it neither looks for executables in a ~/.local/bin/superset nor is it logged in as a user that has such a directory. A quick fix here is to use the full path, but I would recommend moving the executable to a more appropriate directory such as /usr/local/bin and then adding it to the PATH variable in /etc/profile

Answered By: 0x777C