1753681 Members
5724 Online
108799 Solutions
New Discussion юеВ

Re: inittab

 
SOLVED
Go to solution
Steven E. Protter
Exalted Contributor

Re: inittab

Shalom Shiv,

The system is configured to read the /etc/inittab and follow the coded instructions inside.

If you read through it, you'll see critcal things such as default run level and other services that must be running all the time set for respawn.

I almost never touch this file, except when programming a system to work with a ups when it never had one.

It should not be used to run services, that is what daemon's are for. It is not something you should be editing or changing on a day to day basis.

Since HP-UX is based on System V Unix and that came from AT&T, I would surmise you are wrong in your last answer to your own question.

Interesting, seeing lots of short replies where one longer reply should suffice.

Good Luck Shiv,

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Devender Khatana
Honored Contributor

Re: inittab

Hi,

Yes, it is a text file but with prescribed formatted entries as described earlier. The respawn entries for getty are taken from /etc/gettydefs.

These are more useful if you configure systems with dump terminals and wish to match the baudrate,bits,parity etc.

init is the process which always runs with process ID of 1 and do the needful (respawn etc) according to the entries in /etc/inittab. The process reads the file at boot and desides the run level of the system on boot from the entry in second column of first line of the file.

If the file does not exist the system will go to single user mode.

Also as the file is read only at boot, for any changes in the file to take effect always use

#init q

HTH,
Devender
Impossible itself mentions "I m possible"
Asif Sharif
Honored Contributor

Re: inittab

The /etc/inittab file is a configuration file read by the init process. This file contains entries in the following general format.

id:rstate:action:process

Each entry consists of one line in the file. However, an entry can be continued on the next line by ending the line with a backslash character. The fields in the inittab file are explained here.

id : It is a unique ID for each entry and can be 1 to 4 characters long.

rstate: This is the runlevel in which the entry is processed. Multiple runlevels can be specified in this field. If no runlevel is given, the process is assumed to run in all runlevels.

action : This is a keyword that tells init how to treat the process specified in the next field. A keyword "boot" in this field shows that the process is started at boot time but to not wait for its termination. The init process does not restart the process after it terminates. The keyword "bootwait" tells init to start the process at boot time and to wait for its termination; init does not restart the process after it terminates. The "initdefault" keyword tells init to which runlevel the system goes after the boot process is completed. It shows the default runlevel of the system. The "respawn" keyword tells the system that if this process does not exist or terminates due to some reason, restart it. A "sysinit" keyword in this file shows that this entry is processed before the init process accesses the console. This is usually for the initialization of devices. The keyword "wait" tells init to start the process and to wait for its termination.

process : This is the actual process or command line that is executed.

http://lula.org/meetings/2001-10/notes.html
Regards,
Asif Sharif
James R. Ferguson
Acclaimed Contributor

Re: inittab

Hi Shiv:

You already have plenty of information on '/etc/inittab' so I'll add some general comments.

Whenever you want to classify a file, use the 'file' command.

# file /etc/inittab
/etc/inittab: ascii text

# file /etc/lvmtab
/etc/lvmtab: data

# file /usr/bin/date
/usr/bin/date: s800 shared executable dynamically linked

So, you can see that 'inittab' is an ASCII file; 'lvmtab' is binary data; and 'date' is a PA-RISC executable.

If you examine the manpages for 'file' [which you now should] you will see how 'file' attempts to classify a file. More of the "magic" involved is revealed by examining the mangpages for 'magic(4)'.

With regard to 'inittab' you will find that it, along with many other configuration files, are described in HP-UX section-4 of the manpages. Doing 'man inittab' or 'man 4 inittab' would bring you a wealth of information.

Regards!

...JRF...
Bharat Katkar
Honored Contributor

Re: inittab

Hi Shiv,

Is inittab file a text file ?

YES

How does it respawn various configs ?

Init process is started by the kernel and it has process ID 1 which further reads the inittab file to spawn different processes. Now the way they are started depends on the action field of the inittab (3rd one) which tell us about it. "Respawn" means this process should be always running (e.g. getty) and in case if it dies or gets killed restart it and keep it running.


Believe this file exist only on the unix which is derived from AT&T unix and not from the BSD Unix ? Right ??

Wrong. This exists on all unix flavours and is used in similar way and with same significance.

Hope that helps.
Regards,

You need to know a lot to actually know how little you know
Shivkumar
Super Advisor

Re: inittab

Years back i read that inittab is ":" delimited file. I am mean various fields are separated by ":" and hence it was mentioned therein that it is a kind of database file.

Regards,
Shiv
Victor BERRIDGE
Honored Contributor

Re: inittab

Hi Shiv,
Its more ':' that delimits...
I wanted to add one more thing along with all the previously very good remarks and informations that this file is very sensible, in not respecting its syntax / stanza you may end with a corrupted inittab and a system that may not come up at next reboot...
Therefore it is most important to be sure to never edit (modify) this file with another editor than vi, keep a copy and compare regularly if modification have been brought and find out why (added by software)... if some sofware adds a line, I tend to remove and write the adequate start/stop script in /sbin/init.d and add the links to the correct rc.*d/
(In the worst case you will have to use the model in /usr/newconfig/etc)

All the best
Victor

James R. Ferguson
Acclaimed Contributor

Re: inittab

Hi Shiv:

Delimiters, or Inter-Field_Separators (IFS characters) are a part of any ASCII text file regardless of how complex.

An IFS can be simply a space or tab charater. In fact, by default, the shell splits fields based on this when you do a 'read X Y Z' in a shell script.

The IFS used with the '/etc/passwd' file is the colon (":") character, another very common delimeter.

If you want to apply the term "database" to files like the 'passwd' file you can. The table is simple, but the concept of rows and columns certainly exists.

For instance, a shell script to list the first field (colon delimited) from the '/etc/passwd' file could look like:

#!/usr/bin/sh
OLDIFS=${IFS}
IFS=":"
while read NAME X
do
echo ${NAME}
done < /etc/passwd
IFS=${OLDIFS}
exit 0

Does this help?

Regards!

...JRF...