I am running supervisorctl command with root and without root user. With root user it is ok but with sudo it is not working. Here is the output:

[ec2-user@stg etc]$ sudo supervisorctl status
sudo: supervisorctl: command not found

Now I run with root user:

[ec2-user@stg etc]$ sudo su -
Last login: Tue Jun  6 03:02:55 UTC 2017 on pts/1
[root@stg ~]# supervisorctl status
kafka                            BACKOFF   Exited too quickly (process log may have details)
zookeeper                        RUNNING   pid 24697, uptime 0:25:11

PATH variable is shown below:

[root@stg ~]# echo $PATH

[ec2-user@stg etc]$ echo $PATH

Please help me to fix it.


This is a common problem, and you've correctly identified the source. There are two possible solutions, making sure that all PATH entries present for root are also present for ec2-user by adding the following to your bash profile

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin:$PATH"

Or, IMO the more elegant solution, make sure your PATH includes the specific directory containing supervisorctl.

You should start by finding the parent directory by running whereis supervisorctl under root.

# whereis supervisorctl

Which should then be included in your bash profile


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.