init.d script not starting on startup

Solution 1:

Doing "consumer &" will simply background the task and go on. If the owning shell terminates, it will terminate any background tasks. You say the script works on command line, but your daemon won't survive if you log out?

You want to start your daemon with something like start-stop-daemon.

EDIT: actually, on reading your text again, I'm not sure if consumer is a daemon at all? If you just want to run some code on startup (e.g. housecleaning), you write a line in /etc/rc.local.

If the script takes a long time to run, you may want to disown it. I.e:

consumer &
disown %1

The script will now survive the shell termination. Note tho, that if the shell outputs text, it will retain the same tty, which may cause problems, depending on what happens to it after its owning shell terminates.

Solution 2:

Try specifying the full path to consumer. I would suspect that it isn't in the default path at that point, hence it's failing to execute it.

Tags:

Ubuntu

Init.D