[ILUG] "NT Service" in Linux
lbedford at wbtsystems.com
Fri Jan 21 11:34:34 GMT 2000
> -----Original Message-----
> From: Vinayak Risbud [mailto:vinayak_risbud at asiansonly.net]
> 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 ?
> If this is possible, can anybody tell me, where can I find help
> about it ?
There are two ways that linux has historically approached this.
Slackware uses the bsd still boot up scripts, in which you need to edit
/etc/rc.d/rc.local to run your files, and /etc/rc.d/rc.shutdown to close it
Redhat/Debian/Derivatives use SysV startup (with which I am a lot more
The system basically runs init on startup, which then does a number of
things. It runs
the rc.sysinit script, and then changes to the runlevel mentioned in
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
It runs the scripts in /etc/rc.d/rc3.d (in this case), in order. So on my RH
K20rstatd K60mars-nwe S15netfs S45pcmcia S75keytable S99linuxconf
K20rusersd S05apmd S20random S50inet S80sendmail S99local
K20rwhod S10network S30syslog S55named S85gpm
K50snmpd S11portmap S40atd S60lpd S85httpd
K55routed S13ypbind S40crond S60nfs S90xfs
It sill run S05apmd first, and go through in ascending order. When shutting
down, it does the same, but
with the K scripts.
The other thing is that these are generally just symlinks from
/etc/rc.d/rc3.d to /etc/rc.d/init.d. Each
of the scripts in /etc/rc.d/init.d takes a start/stop argument to tell it
what to do. So if you want
to add something in redhat, the easiest way I've found is to take one of the
scripts in /etc/rc.d/init.d,
customize it to start/stop the program you want, and then use chkconfig.
chkconfig --list will show you want programs will be run in each runlevel.
chkconfig --add newprogram will setup chkconfig to understand the newprogram
script in /etc/rc.d/init.d
chkconfig --level 35 newprogram on will add the correct symlinks to make
newprogram run on bootup in runlevels
3 and 5.
There is more info on http://support.redhat.com, look for info on ntsysv.
Liam Bedford 01-4170153
System Administrator WBT Systems, Block 2, Harcourt Ctr.,
Harcourt St., Dublin 2
More information about the ILUG