Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Have custom dropr message queue pollers I'm trying to start up via /etc/init.d in ubuntu. All 3 scripts are super-simple one liners and work perfect via command line, but for some reason, only one of them actually works when the server boots up. All have 775 perms, and this works great:

sudo /etc/init.d/app-poller.sh 

Here's an example script (has to run as www-data user):

[/etc/init.d]$  cat /etc/init.d/app-poller.sh 
su - www-data -c "bash -c '/path/to/dropr-server/daemons/app-poller.php'"

I've run removed / re-entered the inittab entries several times via:

updates-rc.d -f app-poller.sh remove
updates-rc.d app-poller.sh defaults

rcconf script also says everything is starting fine. I've followed all the instructions here: http://jonathonhill.net/2009-04-23/auto-start-a-shell-script-on-ubuntu-server/ here and here: http://stringofthoughts.wordpress.com/2009/04/16/adding-removing-shell-scripts-ubuntu-810/

And I've looked for output in all the usual suspects (/var/log/messages, /var/log/daemons, etc)... still no clue.

Would very much like to at least have some insight into why this is failing. Anyone know which logfiles I can reference to see what is going wrong & why?

share|improve this question
Two more things I've tried (without luck): 1) changed the order of each script (tried 'default [97,98, or 99] for each) 2) tried changing the scripts shell from "bash -c '/path/to/..." to absolute path of sh: "/bin/sh -c '/path/to/..." –  rICh Nov 1 '11 at 16:15

3 Answers 3

Try calling the init-script while simulating the boottime environment:

env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" /etc/init.d/your-daemon start 

Do add some debug output to your script if you don't see any output from that command.

share|improve this answer

Try changing:

su - www-data -c "bash -c '/path/to/dropr-server/daemons/app-poller.php'"


/bin/su - www-data -c "/bin/bash -c '/path/to/dropr-server/daemons/app-poller.php'"

share|improve this answer
Thanks Mike. Still same result -- only my script at level 97 starts. The one at 98 still doesn't... running it from sudo works just fine with a "sudo nohup /etc/init.d/second-poller.php > /dev/null &" –  rICh Nov 1 '11 at 16:47
Beyond suggesting using grep in the /var/log directory to search for dropr, I don't know what else to say. Confirm via ls that the proper symlinks you expect are actually created for your S97, S98, and S99 scripts (and the same for your K scripts) in /etc/rc?.d/ directories...? –  Mike Nov 1 '11 at 19:15

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.