Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have one script to start a service on my ubuntu. I added it on boot machine using "# update-rc.d projeto defaults". But it still doesn't start with the boot machine. I think is because I am using other user to start the script "su - www-data -c ...". But I am not sure, because I run the update-rc.d command as root. When I execute the script from a terminal, it asks the password of the user www-data.

Does anyone know what is happening? Thanks a lot! Felipe

# /var/www/boinc/projeto/bin/start

function action {
        su - www-data -c "/var/www/boinc/projeto/bin/$1"

case $1 in
        action $1
        echo "ERRO: usar $0 (start|stop|status)"
        exit 1
share|improve this question

migrated from Sep 14 '12 at 21:26

This question came from our site for professional and enthusiast programmers.

Doesn't the -c option need to go before - user? – tripleee Sep 14 '12 at 14:52
No, didn't work with the -c before - user – user1546679 Sep 14 '12 at 14:58

I wrote a script with sleep function between the commands and it worked...

# /var/www/boinc/projeto/bin/start

su - www-data -c "/var/www/boinc/projeto/bin/stop"
sleep 20
su - www-data -c "/var/www/boinc/projeto/bin/start"
share|improve this answer
You can even accept your own answers... (but maybe only after a certain time) – glglgl Sep 14 '12 at 21:19

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.