Upstart: cannot run as root
        Posted  
        
            by 
                Ronni Egeriis
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Ronni Egeriis
        
        
        
        Published on 2014-08-22T08:24:42Z
        Indexed on 
            2014/08/22
            10:21 UTC
        
        
        Read the original article
        Hit count: 448
        
I have made this upstart script, which starts a Node.js service. But all of the sudden the service has stopped, and upstart has failed to restart it. Now that I am trying to start it manually, it fails to recognize my service:
start: Unknown job: queue
The script is properly placed in /etc/init, and should have the correct rights:
-rw-r--r--   1 root root  200 Aug  7 13:30 queue.conf
When I check the config file with init-checkconf however, it says that it is not able to run as root:
root@production1:~# init-checkconf /etc/init/queue.conf 
ERROR: cannot run as root
What causes this error and how do I solve it?
Debug info:
Ubuntu 12.04.3 LTS
root@production1:~# service --version
service ver. 0.91-ubuntu1
Edit
Here's queue.conf:
description "Echo.it command queue"
author      "Ronni Egeriis Persson <[email protected]>"
stop on shutdown
respawn
respawn 20 5
exec sudo -u beanstalk /usr/bin/node /var/www/queue/index.js >> /var/log/queue.log 2>&1
The command sudo -u beanstalk /usr/bin/node /var/www/queue/index.js >> /var/log/queue.log 2>&1 works fine when run manually.
© Server Fault or respective owner