what is the function of /etc/init.d file

Asked by aneesh

suppose I create a shell script and placed it in /etc/init.d file , is it run automatically at system start up time ?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Ian Ace (iaculallad) said :
#1

The /etc/init.d folder contains all stop/start scripts for services on Linux distributions.
Yes, you can simply place a script on the directory for it to execute at bootup.

HTH.

Revision history for this message
aneesh (aneesholv) said :
#2

Please teach me how a single shell script add in init.d ?

On Sat, Apr 10, 2010 at 4:00 PM, Ian Ace A. Culallad <
<email address hidden>> wrote:

> Your question #106983 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/106983
>
> Status: Open => Answered
>
> Ian Ace A. Culallad proposed the following answer:
> The /etc/init.d folder contains all stop/start scripts for services on
> Linux distributions.
> Yes, you can simply place a script on the directory for it to execute at
> bootup.
>
> HTH.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+question/106983/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+question/106983
>
> You received this question notification because you are a direct
> subscriber of the question.
>

--
------with regards,

                      Aneesh.T.V
                      Mob:9544067525

Revision history for this message
Ian Ace (iaculallad) said :
#3

Say you create a script named my_script.sh in /etc/init.d directory:

gksudo gedit /etc/init.d/my_script.sh

- A window will appear for you to input the source of which the script will use to execute. Save file after you're done.
- Make it executable:

sudo chmod +x /etc/init.d/my_script.sh

- Initialize it:

update-rc.d /etc/init.d/my_script.sh defaults

- Now the script will autoexecute at startup.

HTH.

Revision history for this message
Sam_ (and-sam) said :
#4

Can you help with this problem?

Provide an answer of your own, or ask aneesh for more information if necessary.

To post a message you must log in.