An introduction to the /etc/init.d directory
2017-08-08 17:19
417 查看
If you use Linux you most likely have heard of the init.d directory.
But what exactly does this directory do? It ultimately does one thing but it does that one thing for your entire system, so init.d is
very important. The init.d directory
contains a number of start/stop scripts for various services on your system. Everything from acpid to x11-common is
controlled from this directory. Of course it's not exactly that simple.
If you look at the /etc directory
you will find directories that are in the form rc#.d (Where
# is a number reflects a specific initialization level - from 0 to 6). Within each of these directories is a number of other scripts that control processes. These scripts will either begin with a "K" or an "S". All "K" scripts are run before "S" scripts.
And depending upon where the scripts are located will determine when the scripts initiate. Between the directories the system services work together like a well-oiled machine. But there are times when you need to start or stop a process cleanly and without
using the kill or killall commands. That is where the /etc/init.d directory
comes in handy.
In order to control any of the scripts in init.d manually
you have to have root (or sudo) access. Each script will be run as a command and the structure of the command will look like: /etc/init.d/command
OPTION . Where command is
the actual command to run and OPTION can
be one of the following:
start
stop
reload
restart
force-reload
Most often you will use either start,
stop, or restart. So
if you want to stop your network you can issue the command: /etc/init.d/networking
stop . Or if you make a change to your network and need to restart it, you could do so with the following
command: /etc/init.d/networking restart .
About /etc/rc.local script.
This file runs after all other init level scripts have run, so it's safe to put various commands that you want to have issued upon startup.
转自:https://www.ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory/
But what exactly does this directory do? It ultimately does one thing but it does that one thing for your entire system, so init.d is
very important. The init.d directory
contains a number of start/stop scripts for various services on your system. Everything from acpid to x11-common is
controlled from this directory. Of course it's not exactly that simple.
If you look at the /etc directory
you will find directories that are in the form rc#.d (Where
# is a number reflects a specific initialization level - from 0 to 6). Within each of these directories is a number of other scripts that control processes. These scripts will either begin with a "K" or an "S". All "K" scripts are run before "S" scripts.
And depending upon where the scripts are located will determine when the scripts initiate. Between the directories the system services work together like a well-oiled machine. But there are times when you need to start or stop a process cleanly and without
using the kill or killall commands. That is where the /etc/init.d directory
comes in handy.
In order to control any of the scripts in init.d manually
you have to have root (or sudo) access. Each script will be run as a command and the structure of the command will look like: /etc/init.d/command
OPTION . Where command is
the actual command to run and OPTION can
be one of the following:
start
stop
reload
restart
force-reload
Most often you will use either start,
stop, or restart. So
if you want to stop your network you can issue the command: /etc/init.d/networking
stop . Or if you make a change to your network and need to restart it, you could do so with the following
command: /etc/init.d/networking restart .
About /etc/rc.local script.
This file runs after all other init level scripts have run, so it's safe to put various commands that you want to have issued upon startup.
转自:https://www.ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory/
相关文章推荐
- An Introduction to Wavelets and the Haar Transform
- An introduction to the Java 2 Platform, Enterprise Edition specification by way of BEA's WebLogic Server
- An Introduction to Deep Learning for the PhysicalLayer
- checked_delete问题: Beyond the C++ STL: an introduction to boostdeleter::do_it
- Jena文档《An Introduction to RDF and the Jena RDF API》的译文
- [Notes] DevOps Demystified - An introduction to the ideas that are driving DevOps
- Intel SSE Tutorial : An Introduction to the SSE Instruction Set
- An Introduction to the Extended Kalman Filter
- An introduction to the P/Invoke Library open source project
- Beyond the C++ Standard Library: An Introduction to Boost by Bjцrn Karlsson
- 启动weblogic的错误:Could not obtain an exclusive lock to the embedded LDAP data files directory
- an-introduction-to-the-raphael-js-librar
- Beyond the C++ Standard Library: An Introduction to Boost
- An Introduction to the Standard Template Library
- An Introduction To The SQLite C/C++ Interface
- OGRE 入门 二、Basic Tutorial 1 : An introduction to the most basic Ogre constructs
- UML basics: An introduction to the Unified Modeling Language
- An Introduction to the JAIN SIP API
- An Introduction to the Standard Template Library (STL)