add script on boot linux machine

Posted by user1546679 on Super User See other posts from Super User or by user1546679
Published on 2012-09-14T13:54:37Z Indexed on 2012/09/14 21:40 UTC
Read the original article Hit count: 215

Filed under:
|

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

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

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

case $1 in
        start|stop|status)
        action $1
        ;;
        *)
        echo "ERRO: usar $0 (start|stop|status)"
        exit 1
        ;;
esac

© Super User or respective owner

Related posts about linux

Related posts about bash