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

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

1 Answer 1

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.