I've set up my /etc/rc.local to start some services using a couple of scripts to bring my system up on reboot.

One script runs as root and starts nginx, mysql, php etc... and works fine.

The other stuff runs as my regular user, so I'm doing a sudo and it doesn't seem to work at boot time. Is there a problem running as unprivileges users at this stage of the boot process?

My rc.local looks like this -

touch /var/lock/subsys/local

# main system start - web server, db etc...

# services run as me
/usr/bin/sudo -u tim /home/vhosts/myapp/bin/start-app.sh

Running the scripts when the system is up, everything works fine. But at boot time none of the services in start-app.sh start up and I can't find any trace of any errors in any logs.

What have I done wrong here?

  • 2
    This doesn't address the question directly, but using something like Monit to handle this may be a better option. Monit is available as an RPM for CentOS in the DAG repo.
    – cjc
    Aug 10, 2012 at 12:37

2 Answers 2


Try with:

su USER -c 'command &'

You should try /usr/bin/sudo -u tim /home/vhosts/myapp/bin/start-app.sh 2>&1 1>/tmp/start-app.log to write stdout and stderr to a file.

  • stdout and stderr both empty. It appears the script never runs
    – Tim
    Aug 10, 2012 at 13:08

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.