Operating System - HP-UX
1833692 Members
4105 Online
110062 Solutions
New Discussion

Re: who -r command echoes no data, just prompt

 
Kristopher March
Regular Advisor

who -r command echoes no data, just prompt

HP-UX B.11.00 C 9000/800

When I type in who -r it doesn't tell me the run level, just returns with the prompt.
Any help/insite would be greatly appreciated.
"This ain't no burger flippin job!"
15 REPLIES 15
harry d brown jr
Honored Contributor

Re: who -r command echoes no data, just prompt

Kristopher,

Is your system running? Just kidding. How about the output of any other command, like just regular who??

Also, have you checked the patches?

live free or die
harry
Live Free or Die
Sanjay_6
Honored Contributor

Re: who -r command echoes no data, just prompt

Hi,

The problem could be with your /etc/utmp file. Do a init 3 and then run the who command once again and try,

init 3
who -r

Hope this helps.

regds
S.K. Chan
Honored Contributor

Re: who -r command echoes no data, just prompt

Check if you got "-r" file accidently created, because if you have that and try to run "who -r" it'll just give you back the prompt. Remove the file and you'll be fine.

# rm ./-r
Peter Kloetgen
Esteemed Contributor

Re: who -r command echoes no data, just prompt

Hi Kristopher,

another possible solution would be an alias set to the "who -r"- command which delivers this silly output. You can find out by the command "alias" which shows a list of all defined aliases. Or is your computer running Linux, then the command would be "runlevel"...
:-)

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Jon Mattatall
Esteemed Contributor

Re: who -r command echoes no data, just prompt

Hmmmm...

Try entering who -r, and when you get the prompt back enter
"echo $?". This gives you back the return code for the last command.
If it returns "0", the who command was successful.
Anything else (1,127,etc.) is a failure, not found, and so on.
Check /usr/bin/who for permissions as well, but that's a stab in the dark....

HTH

Jon
A little knowledge is dangerous - none is absolutely terrifying!!!
Kristopher March
Regular Advisor

Re: who -r command echoes no data, just prompt

$ alias
autoload='typeset -fu'
command='command '
functions='typeset -f'
grep=/usr/bin/grep
history='fc -l'
integer='typeset -i'
local=typeset
ls=/usr/bin/ls
nohup='nohup '
r='fc -e -'
stop='kill -STOP'
suspend='kill -STOP $$'
type='whence -v'
who=/usr/bin/who

Here is the output of my alias command. I'm wondering about the r= 'fc -e -'(I don't know what it means)
Also, what's the result of running init 3 on a production server running several Oracle databases. Will it affect anything?
who -r is the only command that doesn't work. ie, who -R, who works
"This ain't no burger flippin job!"
Mark Greene_1
Honored Contributor

Re: who -r command echoes no data, just prompt

the "r" alias exists on my system, and who -r works fine, so it is not that.

does the file /tmp/utmp exist on your system? what about /var/adm/wtmp? the info show in who -r is stored in one of these files, and if it is missing, then there is nothing to display.

HTH
mark
the future will be a lot like now, only later
Peter Kloetgen
Esteemed Contributor

Re: who -r command echoes no data, just prompt

Hi Kristopher,

"fc -e" trys to open your history file and shows you the contents. So you don't have to wonder about that. In the file /etc/inittab there is an entry ( normally the first line ) with the "initdefault", which is by default "3". This field is read by init to find out the default runlevel. The system runs up to the defined runlevel. Normally Oracle databases are started also in runlevel 3. You can find out this by having a look into the /sbin/rc3.d- directory with ls -l. The output shows you some links of start- and stop- scripts. If any changes for oracle databases are made, you should see a script, beginning with S (startscript) or K (killscript), a pass number after that and the name of the service to be started or stopped. So you can find out what will be happen!

One more thing you could try is to copy a who- command from another computer (same HP-UX-version! ) to your computer and try it again.

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Kristopher March
Regular Advisor

Re: who -r command echoes no data, just prompt

converted /var/adm/wtmp to ascii and did a more on it. Looks like user loggin info. and nothing else.

Also, looked at /var/adm/utmp and on the second line it has run-level 4.
"This ain't no burger flippin job!"
Peter Kloetgen
Esteemed Contributor

Re: who -r command echoes no data, just prompt

Hi Kristopher,

runlevel 4 was a previous runlevel for systems who worked with HP VUE. At the time now the runlevel 4 is no longer defined in a HP-UX system. You could take a look into the rc4.d- directory for the start- and stop-scripts if your oracle- databases are posted there. If not, you should be able to run a init 3 without any danger. Please post here, if your command shows the normal output then. If not, the /var/adm/wtmp and utmp-file seem to be corrupted.

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Kristopher March
Regular Advisor

Re: who -r command echoes no data, just prompt

rd4.d directory is empty. Thanks for clearing that up for me.

I am still looking into these /var/adm/wtmp and /etc/utmp files. Is there an easy way to re-create them without doing any harm to the system?
Thank you ALL for your time.
"This ain't no burger flippin job!"
Helen French
Honored Contributor

Re: who -r command echoes no data, just prompt

Hi Kris,

Check this out, it will defenitely help you:

http://us-support2.external.hp.com/cki/bin/doc.pl/sid=0a60f5301749b6fd0b/screen=ckiDisplayDocument?docId=200000058669431

HTH,
Shiju

Life is a promise, fulfill it!
Peter Kloetgen
Esteemed Contributor

Re: who -r command echoes no data, just prompt

Hi Kristopher,

it seems like there is a solution to repair the files:

i found two commands which you can use-

/usr/sbin/acct/fwtmp ( -ic )
/usr/sbin/acct/wtmpfix ( files )

the first command translates the entrys to ASCII which makes it easier to find errors. The second one is able to translate ASCII input into binary output. Please read the manpages for those commands. If this doesn't help you should pray you have a support contract, because in ITO there exists also a tool to repair these files. You should do a call then...

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Peter Kloetgen
Esteemed Contributor

Re: who -r command echoes no data, just prompt

Hi Kristopher,

i forgot to tell you to read the manpage for utmp/wtmp to understand the entries in those files. A friend of mine just told me, that the previously mentioned ITO- command would be the best way...


Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Kristopher March
Regular Advisor

Re: who -r command echoes no data, just prompt

Not sure what I'm doing wrong here. Please look at the attached file. I was trying the C code as Shiju suggested I try.
I'm not familiar with ITO command?

Will look into man pages for fwtmp and wtmpfix.

Thanks. :)
"This ain't no burger flippin job!"