Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

A package installed /etc/init.d/ccpd which is a script run at start up. I would like this script to be run as very last of all my start up scripts, how can I achieve this?

share|improve this question
BusyBox users arriving at this post:… Note the comment "executing them in numerical order" – dtmland Feb 12 '15 at 18:25

When your computer starts up, it doesn't run the init.d scripts directly. Instead, depending on what's called the "runlevel", it runs the scripts in /etc/rcN.d (where N is the runlevel). You can determine the current runlevel with the runlevel command; mine returns 2 in normal operation. That means that when the computer started up, it ran the scripts in /etc/rc2.d. The contents of rc2.d are just symlinks to scripts in /etc/init.d, named according to whether they should be started or stopped, and the order they should be run.

Use the runlevel command to find out what runlevel your computer is at (probably 2), then look in /etc/rc2.d for a link named SNNccpd, which will be a symlink to /etc/init.d/ccpd, and rename it to S99zzzccpd - or whatever it takes to get it to sort after the other entries - that will cause it to run last.

There's more information about init.d scripts and runlevels at

share|improve this answer
If Randy Orrison 's advice does not work, sometimes you run into a problem that boot scripts run concurrently. You would then need to look at the init script and modify it, possibly adding a sleep (perhaps easiest) or converting it to an upstart script. – bodhi.zazen Dec 28 '11 at 16:20

Rather than putting it as a service which always keeps running, what you can do remove it as a service from /etc/init.d

and make a script and put it in /root/bin or /usr/local/bin

Inside that script,

#!/bin/bash sleep 300
#call your service and run it in background
/usr/bin/ccpd &

the startup will continue and your stuff will run after 5 minutes

Now the last step is to make your script run on startup, either add your script to /etc/fstab or to profile

share|improve this answer
Why would I want to do this? As it is a service, should I not really use the ubuntu service options for this? Anyway, fstab is meant for mounting hard drives and profile for the different sessions. So that is not working. – Peter Smit Dec 28 '11 at 11:44
it will still run as a service, but you are not configuring using /etc/init.d. fstab is not only for mounting drives, you can do whtever stuff you want at startup, you can do it in fstab and profile. basically you are executing a scripts, either do it manually, or let the linux do for you using /etc/init.d/ or you can tell ubuntu how you want that service to be up using fstab or profile – Rajesh Pantula Dec 28 '11 at 11:49
@rao_555: Rao, you are really wrong here, and you are spreading missinformation. Please check fstab manfile. – Javier Rivera Dec 28 '11 at 12:10

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.