ilug-admin at linux.ie wrote:
>> Hi friends,
>> In NT we have a concept called, "Services", which is basically
> an EXE file, which will be automatically started by the OS , while
> booting, and the Service will be stopped by the OS while shutting
> down ?
>> Can any body tell me, Is this possible with Linux OS. What is the
> Linux Concept , which is parallel to NT Serivces ?
Under Linux, there exists a set of plain text scripts, in a structured
directory tree.
The base directory is called (e.g. under RedHat)
/etc/rc.d/rcN.d
where N is the 'runlevel' or current state of the machine. Level 3
is the standard runlevel, and thus /etc/rc.d/rc3.d/ is the standard
directory on boot into a textmode Linux system.
There are two types of files in the directory : ones beginning with
'S', and ones beginning with 'K'.
They are all of the form 'Knnsomename', where 'nn' is a number and
'somename' is a descriptive but irrelevant title, such as nfsd, smbd,
crond, etc.
On startup, all of the 'S' scripts are executed, one by one, in
numeric order. On shutdown, all of the K scripts are executed the
same way. The scripts are passed a command line value of 'start'
during startup and 'stop' during shutdown.
These scripts can be either local scripts or links to a common
script directory (/etc/rc3.d/init.d). Adding a service is as simple as
adding a new file of the correct format (Snnname) and it'll be run
automatically on startup.
You can also run the scripts manually during runtime, using the same
commandline values of 'start' and 'stop'. For most system default
scripts provided with distributions of Linux, you can also pass such
commands as 'restart' (combination of stop followed by start),
'status' and so forth.
Running '/etc/rc.d/rc3.d/S91smbd restart', for example, will restart
the Samba service which is started by that script at runtime.
Regards,
Vin
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!