Adding symlink to scripts into rc<number>.d folders to start process during system startup [closed]
Asked Answered
C

1

4

I am using fedora 15.

I am trying to add MYSql daemon to start during system strtup.

I have understood that I will have to add it to rc5.d as it is the default target & is graphical.target.

from inittab:

systemd uses 'targets' instead of runlevels. By default, there are two main targets:

multi-user.target: analogous to runlevel 3
graphical.target: analogous to runlevel 5

From An introduction to services, runlevels, and rc.d scripts :

When the system is shut down, there is another symlink in the /etc/rc0.d and /etc/rc6.d directories (halt and reboot, respectively) that starts with a K instead of an S, which tells init to shut down the process.

I notice that symlink to httpd are present in all the rc<number>.d folders as symlink: K15httpd -> ../init.d/httpd. No symlink is present that starts with S. Makes sense as I have to start it manually.

  • Why is the symlink K15httpd -> ../init.d/httpd present in all the rc<number>.d folders?

  • What should I name the symlink if I want to start httpd during system startup?

  • What is the number that is present in the symlink? i.e. K15httpd -> ../init.d/httpd what is 15 here?

  • I read (here) that the symlink to MYSql should be S98mysql is it right and what should the name to symlink that starts with K should be?
Carboniferous answered 12/1, 2012 at 15:33 Comment(2)
chkconfigKnick
And how is this programming related?Barehanded
C
3

The naming convention for the RC scripts is as follows for any in /etc/init.d

  • Start scripts S##<base script name>
  • Kill scripts K##<base script name>

The ## represent the order in which the script will be executed during the run of runlevel control script. The order in which the scripts are executed is:

  • Kill scripts
  • Start Scripts

The order in which it will be execute is the same as the order of files in the output of:

`ls /etc/rc#.d/K*`
`ls /etc/rc#.d/S*`

So by this token the existence of K15httpd script implies that at this runlevel in your case 5 the apache(or another web service) should be stopped.

By same token the kill script for MySQL in lower levels then the one you start it in would be K02MySQL.

You can look at this link to read about the writing the System V init scripts.

Camorra answered 12/1, 2012 at 15:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.