add script on boot linux machine
- by user1546679
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