Operating System - HP-UX
1827880 Members
1589 Online
109969 Solutions
New Discussion

Restarting a process from inittab file

 
SOLVED
Go to solution
fg_1
Trusted Contributor

Restarting a process from inittab file

Good morning all.

I have a tty process that is listed in my /etc/inittab file that I would like to restart manually. Can anyone tell me the process for doing so. The device file is called ttyd2a2 connected on the 2nd port of a 16port mux.

Thanks in advance.
9 REPLIES 9
Christopher Caldwell
Honored Contributor

Re: Restarting a process from inittab file

# init q

man init

Re-examine the inittab entries without changing the run level.
<\SNIP>
Ian Dennison_1
Honored Contributor

Re: Restarting a process from inittab file

'init Q' will re-examine the inittab entries, according to the man page. Have never tried it myself!

Does the tty commmand have 'respawn' set as an option in 'inittab'? is it not respawning?

Share and Enjoy! Ian
Building a dumber user
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Restarting a process from inittab file

This is not a normal thing to do. Does the inittab tab entry have 'respawn' in the third field? If so getty, should be fired off upon each hangup. If you for some reason wish to start another process that uses this port then you must first edit inittab and set the 3rd field to 'off'. You then do an 'init -q' to force a reread of inittab. You can then launch whatever process you wish. If you do not set the field to 'off' input and output will be interleaved between getty and your process and chaos is assured.

Clay
If it ain't broke, I can fix that.
Uday_S_Ankolekar
Honored Contributor

Re: Restarting a process from inittab file

Hi,

If the line /etc/inittab shows 'respawn' then change it to 'off'

-USA..
Good Luck..
Christopher Caldwell
Honored Contributor

Re: Restarting a process from inittab file

Hmmm. I supposed that the entry was changing in inittab, thus init -q.

There's no reason to init -q to restart a session if inittab hasn't changed.
Bill McNAMARA_1
Honored Contributor

Re: Restarting a process from inittab file

for a second console,

just uncomment one of the following.

every time you logout, the login will return once the respawn is there.
init q
to reread the inittab if you made a change.

If it's not a terminal, you may have to modify /etc/uucp/Devices
See the instructions in the file.

ie:
#ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600
ttp2:234:respawn:/usr/sbin/getty -h tty2p2 9600
#ttp3:234:respawn:/usr/sbin/getty -h tty0p3 9600
#ttp4:234:respawn:/usr/sbin/getty -h tty0p4 9600
#ttp5:234:respawn:/usr/sbin/getty -h tty0p5 9600
It works for me (tm)
Sanjay_6
Honored Contributor

Re: Restarting a process from inittab file

Hi Frank,

To stop getty on a particular port, edit the /etc/inittab file and change respawn to off for that port in the file, Save the file and exit. Do a "init q" to let the system reread the inittab file. It will now stop the getty process for the port for which you changed respawn to off.

Now to do the reverse, edit the file again, change off to respawn and then save the file and exit. Do a "init q" so that the system rereads the file and the system will now start the getty for the port for which you chaged off to respawn.

Hope this helps.

regds
Wodisch
Honored Contributor

Re: Restarting a process from inittab file

Hello Frank,

I am not so certain wether I undersdtand your question...
But in case you want to have a serial login on MUX2/Port2 you need the following setup:

1) /etc/inittab: enter a line like this:
ttp2:234:respawn:/usr/sbin/getty -t 300 tty2p2 port2 vt100 # port2

2) /etc/gettydefs: enter a line or paragraph like this:

port2 # B9600 SANE CLOCAL CS8 IXON IXOFF TAB3 HUPCL # B9600 SANE CLOCAL CS8 IXON IXOFF TAB3 HUPCL #Serial Login: #port2

3) command line: init q

And what it is about:
1) "init" will start a process "getty" and remember its process id. When it exits "init" will start it again.
The parameters are:
-t 300 # timeout 300s
tty2p2 # MUX2 Port2
port2 # reference info "/etc/gettydefs"
vt100 # the login dialog will start with a clear-screen sequence for VT100 terminals

2) The line/paragraph is split into 5 areas by hash-signs (#).
The first is the name and is used by "getty" to find the line/paragraph.
The second are the "Initial Flags" (man stty) to setup serial communication.
The third are the "Final Flags" for the communication (after login).
The forth is the login dialog.
The fifth is the "next" paragraph to be used - in case the user trying to log in presses the key.

When "getty" starts, it tries to open the device "/dev/" followed by its first parameter and set it to the "initial flags" in the paragraph addresses with the second parameter. Then it dispays the text from tha forth field and wait for the login name. Then it sets the "final flags" and uses "exec(2)" to execute the program "login" (which which ask for the password).

3) After this command is executed, process #1 (init) will re-read its config file (/etc/inittab) and hence start the new "getty" command.

BTW: Be certain to match the serial communicatio parameters of your terminal with the paragraph used in "/etc/gettydefs"!

HTH,
Wodisch
fg_1
Trusted Contributor

Re: Restarting a process from inittab file

Thank you all

Each of your answers helped a great deal. It's nice to know and deal with such professionals.