Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install an init.d script, to run celery for scheduling tasks. Here is the steps I followed:

  • copied the file celeryd and pasted it in folder /etc/init.d/
  • created a configuration file celeryd in folder /etc/default/

now when I tried to start it by sudo /etc/init.d/celeryd start, it throws error sudo: /etc/init.d/celeryd: command not found

I googled about how to install init.d, I got this SO-question.

it says to issue a uname -a and when I does I get this:

Linux capsonesystem8-desktop 3.2.0-43-generic-pae 
#68-Ubuntu SMP Wed May 15 03:55:10 UTC     
2013 i686 i686 i386 GNU/Linux

and also it says use utils like insserv to enable init.d script so tried:

insserv /etc/init.d/celeryd but it throws error insserv: command not found

so I tried to install insserv sudo apt-get install insserv. but it say aleady installed:

insserv is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 222 not upgraded.

So how to install init.d script?? Any help will be appreciated.


when I tried:

$ sh -x /etc/init.d/celeryd start

it reveal some errors. may be that is why the service won’t start.


I cleared all the errors when I run $ sh -x /etc/init.d/celeryd start but still sudo /etc/init.d/celeryd start throws command not found error

share|improve this question
I don't have time for an answer now, but, if you want this to run as part of your startup, then I think you have to add links to your script in the various runlevel directories so Linux will handle starting and stopping it for you. (/etc/rc[0-6].d) This process is gradually being replaced by a newer method (I think it's called upstart.), but I haven't looked into that at all. The link in your post addresses some of this. – Joe Aug 21 '13 at 19:59
up vote 36 down vote accepted

Your celeryd script is probably not executable, that's why sudo /etc/init.d/celeryd is returning command not found. So, you need to first make it executable.

To do so, run the following commands:

sudo chmod 755 /etc/init.d/celeryd
sudo chown root:root /etc/init.d/celeryd

The first line changes the permissions to -rwxr-xr-x, and the second line ensures that the owner and group owner of the file is root.

Once this is done, I assume you will need to use sudo /etc/init.d/celeryd start to start the daemon.

share|improve this answer
Thanks now it works. i spend a lots of time on it. :-) – suhail Aug 21 '13 at 7:23

When you copy the script into place, don't forget to make it executable and owned by root:

sudo chmod +x /etc/init.d/celeryd
sudo chown root:root /etc/init.d/celeryd

Once you have installed that, you can set it to start automatically on boot with:

sudo update-rc.d celeryd defaults
sudo update-rc.d celeryd enable
share|improve this answer
Cant believe this worked! I was searching all day how to make my uwsgi service start automatically on boot, this 2 simples commands worked! – Yuri Heupa Mar 16 at 2:31

If you get the command not found error when you run insserv, you may fix it by running the following command:

sudo ln -s /usr/lib/insserv/insserv /sbin/insserv

Then see insserv -h or man insserv for help.

Also you can try with:

sudo update-rc.d celeryd defaults


share|improve this answer

This is command sequence to autostart your daemon at boot time:

sudo cd /etc/init.d
sudo chown root:root celeryd
sudo chmod 755 celeryd
sudo ln -s /usr/lib/insserv/insserv /sbin/insserv
sudo insserv celeryd
share|improve this answer

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.