3
votes

I am have a Linux board on which I have added one init script under /etc/init.d/ directory. I can start,stop,restart service using script manually. For Debian we do use "update-rc.d" to execute this script at boot time. But i don't have this command, How then can i execute the script at boot time? Is there any alternate way to do this?

2
Does this mystery distro have a name? - Ignacio Vazquez-Abrams
Just edit /etc/inittab? - Joe
Its a propritory linux port. - er_shrenik
Thanks it works in when i executed init script from inittab :) - er_shrenik

2 Answers

1
votes

You can edit the /etc/inittab file.

Also, there are 2 other alternatives to update-rc.d:

  1. Rcconf - Rcconf allows you to control which services are started when the system boots up or reboots. It displays a menu of all the services which could be started at boot. The ones that are configured to do so are marked and you can toggle individual services on and off.This tool configures system services in connection with system runlevels. It turns on/off services using the scripts in /etc/init.d/.

  2. File-rc - Alternative boot mechanism using a single configuration file This package provides an alternative mechanism to boot the system, to shut it down and to change runlevels. The /etc/rc?.d/* links will be converted into one single configuration file /etc/runlevel.conf instead, which is easier to administrate than symlinks, and is also more flexible. The package will automatically convert your existing symlinks into the file method on installation, and convert the file back into symlinks on removal.

0
votes

inittab has some other uses. The main use is creating "unkillable" service, that will be restarted every time it dies.

If you need just usual service, you can just create symlinks manually. Example from apache, like very typical service with default runlevels.

# ls -la /etc/rc*.d/*apache2
lrwxrwxrwx 1 root root 17 Oct  2 13:45 /etc/rc0.d/K02apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 17 Oct  2 13:45 /etc/rc1.d/K02apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 17 Oct  2 13:45 /etc/rc2.d/S02apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 17 Oct  2 13:45 /etc/rc3.d/S02apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 17 Oct  2 13:45 /etc/rc4.d/S02apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 17 Oct  2 13:45 /etc/rc5.d/S02apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 17 Oct  2 13:45 /etc/rc6.d/K02apache2 -> ../init.d/apache2

So it should be killed at runlevels 0 1 6 and started on runlevels 2 3 4 5.