-1

I can log in as super user and run a program, now I want to check the status without logging in as super user.

example:

dev01:~$ sudo su
dev01# forever list
info:    Forever processes running
<some more output>
dev01# exit
dev01:~$ sudo forever list
sudo: forever: command not found 

How can I check the program status without logging in as supper user ?

I do not have 'su' password but I am a sudoer.

  • welcome to U&L, your question is somehow unclear, whatever interactive process ran by forever command, thay are likely to be shut when you exit root session. – Archemar Dec 1 '15 at 13:37
  • 1) what is the path of forever command ? 2) it should be added, with full path in sudoer.conf file. – Archemar Dec 1 '15 at 13:41
  • let me explain a bit. I have a ssh object and using that ssh object to perform server running status. As the server running as superuser I am not able to check the server status without root password. How can I gat the info with sudo access. Forever is a demon process and added to path. – Cdas Dec 1 '15 at 13:57
0

sudo is probably configured to override your $PATH, and forever isn't in that path. There are a few solutions:

  1. Give sudo the full path to the command: sudo /usr/local/sbin/forever (or whatever the path is).

  2. Change (or probably ask your sysadmin to change) the sudo configuration to include the right directory. If changing it yourself, you'd use visudo, though beware that breaking the sudo config may leave you locked out.

  3. Use sudo -s or sudo -i to get a root shell, then set $PATH if needed. Finally run the command. This defeats sudo's logging of the run command, so really isn't preferred.

Some of the above may not be permitted by the sudo config. Then you're just left with "ask the sysadmin to fix it."

  • Thanks for the update. It make sense now. I have to try out the options. – Cdas Dec 2 '15 at 20:37

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.