Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/

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

What have I done wrong here?

share|improve this question
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 '12 at 12:37
up vote 4 down vote accepted

Try with:

su USER -c 'command &'
share|improve this answer
Bingo. Works. Thanks! – Tim Aug 10 '12 at 13:17

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

share|improve this answer
stdout and stderr both empty. It appears the script never runs – Tim Aug 10 '12 at 13:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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