Cron fails with the message Superset: command not found

Issue

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:

[email protected] /var/spool/mail$which python3
/usr/bin/python3 

[email protected] /var/spool/mail$which superset
~/.local/bin/superset

[email protected] /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

Solution

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

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published