LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   What will happens if i put scripts inside /etc/init.d ? (http://www.linuxquestions.org/questions/slackware-14/what-will-happens-if-i-put-scripts-inside-etc-init-d-931309/)

Linux.tar.gz 02-25-2012 09:34 PM

What will happens if i put scripts inside /etc/init.d ?
 
Hi !

Will they be executed at boot ?

kasl33 02-26-2012 01:33 AM

Why not give it a shot and find out? Create this file:

init_test
Code:

#!/bin/bash
touch ~/init_file

Put it in /etc/init.d/

Richard Cranium 02-26-2012 04:22 AM

Quote:

Originally Posted by Linux.tar.gz (Post 4612079)
Hi !

Will they be executed at boot ?

Not unless they are called by another script that's part of the init chain. See /etc/inittab

Alien Bob 02-26-2012 06:57 AM

The init.d directory (in Slackware, "/etc/init.d" is a symlink to "/etc/rc.d/init.d") has nothing to do with "/etc/inittab".

If you add scripts to init.d they will have to be called with a "start" or "stop" parameter by start- and kill commands which you place in the runlevel directories like "/etc/rc.d/rc3.d" or "/etc/rc.d/rc4.d".
This is all initiated by th SysV rc script "/etc/rc.d/rc.sysvinit".

Eric

Linux.tar.gz 02-26-2012 09:05 AM

Perfect ! Thanks ^^.

Richard Cranium 02-26-2012 01:44 PM

Quote:

Originally Posted by Alien Bob (Post 4612287)
The init.d directory (in Slackware, "/etc/init.d" is a symlink to "/etc/rc.d/init.d") has nothing to do with "/etc/inittab".

If you add scripts to init.d they will have to be called with a "start" or "stop" parameter by start- and kill commands which you place in the runlevel directories like "/etc/rc.d/rc3.d" or "/etc/rc.d/rc4.d".
This is all initiated by th SysV rc script "/etc/rc.d/rc.sysvinit".

Eric

Which is called by /etc/rc.d/rc.S, /etc/rc.d/rc.K, /etc/rc.d/rc.M, /etc/rc.d/rc.0, and /etc/rc.d/rc.6, all of which are called by the appropriate entries in /etc/inittab.

Plus nothing prevents you from placing a script in /etc/rc.d/init.d and calling it directly from one of the "normal" init scripts.

Linux.tar.gz 03-06-2012 08:51 PM

Ok.

Thanks.


All times are GMT -5. The time now is 01:52 PM.