run service with user root gives Unknown job

As you can see from the following output(not limited to mysql, other service gives similar result), when run service/status with sudo, it gives correct result, but gives ‘Unknown job’ when run directly with root.

I googled a lot, but key words like ‘status/service’ have multiple meaning, so i found nothing related to this problem, only some similar questions answering why ‘unknown job’ when run with ‘sudo service…’.

root@ubuntu-user:/etc/init# status mysql
status: Unknown job: mysql

root@ubuntu-user:/etc/init# sudo status mysql
mysql stop/waiting

root@ubuntu-user:/etc/init# service mysql status
status: Unknown job: mysql

root@ubuntu-user:/etc/init# sudo service mysql status
mysql stop/waiting

I have checked with strace, didn’t find anything(output is too long), and I think it’s the restriction of status and service, but nothing in man page about root or sudo.

Question: why service gives Unknown job when runs service without sudo?

OS: Ubuntu 14.04 LTS


Source: ubuntu

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.