Operating System - HP-UX
1833445 Members
3927 Online
110052 Solutions
New Discussion

Re: app holding on the console from inittab

 
JUP
Regular Advisor

app holding on the console from inittab

Hi

I have put the following line in /etc/inittab:

prod:234:once:/progs/chkprod < /dev/console > /dev/console 2>&1


Each time I start up the system (HP B.11.23 Itanium 2) the chkprod program starts up holds on to the console - therefore not displaying the console login screen.

If I telnet and type in: "ps -ft console" I can see the chkprod task on the console port. If I kill the task via "kill -9 xxx" or Ctrl C on the console then the login screen appears.

The same program and /etc/inittab entry on a HP 9000 HP-UX 11.00 works fine. "chkprod" runs in the background and stays as a daemon, releasing the console screen to display a login prompt. But not on HP 11.23 Itanium.

I am using the "once" parameter in the inittab so the system does not wait for its completion as its a background task.

I have also tried running a script from the inittab file and in the script I type in "exec chkprod" thinking that may work, but still no luck.

Any suggestions on how to make make the console login appear after running chkprod from inittab would be much appreciated.

Thanks in advance
JUP

11 REPLIES 11
Bill Hassell
Honored Contributor

Re: app holding on the console from inittab

Is there any reason to associate the program with the console? If the goal is to write the output somewhere it can be seen, I'd redirect the output into a file and perhaps after the program is done, cat the file onto /dev/console. inittab isn't used much anymore, especially for startup applications. The rc files in /sbin/init.d are used for these tasks.


Bill Hassell, sysadmin
JUP
Regular Advisor

Re: app holding on the console from inittab

Thanks Bill for your prompt reply.

I do definitely need the output of the program displayed onto the console as it will be the only screen connected to this system (all telnet, serial connections will be disabled).

Maybe I will need to do it through rc files - its just that we've always used inittab files in the past but for our first Itanium system it does not seem to behave properly. If I put them in the rc directory would all output be directed to the console as thats what I need to happen ?

Thanks again
JUP
JUP
Regular Advisor

Re: app holding on the console from inittab

Tried running through rc2.d scripts without much luck.

I really need to run it through /etc/inittab to keep it consistent with all other system builds - any other ideas would be appreciated.

Thanks

Re: app holding on the console from inittab

I understand why you are directing output to the console, but why are your redirecting input from the console? Won't this do it?

prod:234:once:/progs/chkprod < /dev/null > /dev/console 2>&1

HTH

Duncan

I am an HPE Employee
Accept or Kudo
JUP
Regular Advisor

Re: app holding on the console from inittab

Duncan - I had also tried the "< /dev/null" with no luck.

In fact I also tried "> /dev/null" instead of the "/dev/console" - again without much luck.

Thanks anyway for your response
Scot Bean
Honored Contributor

Re: app holding on the console from inittab

So my 11.23 machine has many similar calls by default in its /etc/inittab:

muxi::sysinit:/sbin/dasetup /dev/console 2>&1 # mux init

vol1::sysinit:/sbin/init.d/vxvm-sysboot /dev/console 2>&1 ##vxvm

vol2::sysinit:/sbin/init.d/vxvm-startup start /dev/console 2>&1 ##vxvm

brc1::bootwait:/sbin/bcheckrc /dev/console 2>&1 # fsck, etc.

sqnc::wait:/sbin/rc /dev/console 2>&1 # system init

The big difference I see comparing these to yours: these all run once, yours will run at least twice on a normal boot (run level 2 and run level 3)

Perhaps this works on earlier, slower releases, but 11.23 loads faster, and maybe you get overlapping runs...?

I would try selecting ONE run level, say 3, and see if that works.
JUP
Regular Advisor

Re: app holding on the console from inittab

I just tried only putting 3 (level 3) in the /etc/inittab entry - still no luck. The console is still locked until I kill the task started in inittab.

Any other suggestions ?
Scot Bean
Honored Contributor

Re: app holding on the console from inittab

- So any idea if or why the app is hanging?
- Can you run '/progs/chkprod' by itself OK form the command line, once the machine is up?
- What does this app do?
- Is it compatible with IA?
- Have you checked the actual console, does it display something there, like user input?
JUP
Regular Advisor

Re: app holding on the console from inittab

Scot - the app does NOT hang when run from inittab or run by itself from a command prompt. It runs fine and outputs all important info to the console. I want it run ion the background - that is the issue - so to release the console for login purposes.

'chkprod' is a C program that has an infinite loop that continually checks another systems status. The problem I have is that when run from /etc/inittab it holds onto the console (foreground) where I would like it to run in the background as a daemon.

I have tried the & sign at the end of the inittab entry but then the output is not directed to the console - which I need.
Florian Heigl (new acc)
Honored Contributor

Re: app holding on the console from inittab

JUP: err - You could redirect the applications output through logger and set a specific facility which in turn is outputted to console by a statement in syslog.conf - how about that?
yesterday I stood at the edge. Today I'm one step ahead.
Scot Bean
Honored Contributor

Re: app holding on the console from inittab

So I ran some simple experiments on my 11.23 machine and could not recreate your problem. I could always login via the console with background scripts logging direct to /dev/console.

More ideas:
- try removing the input redirect altogether
- try append redirects (>>)
- replace the C app with a simple shell script ('hello world'), see if behavior changes