Operating System - HP-UX
1753798 Members
7295 Online
108805 Solutions
New Discussion юеВ

Re: History not working in root user

 
SOLVED
Go to solution
Jestin John Chacko
Regular Advisor

History not working in root user

Dear,

For me history command is not working for the root user,in the default shell.but in keysh shell its working,for all other users its working properly.i am working with rx series itanium servers(11iv23 os)

1> how can i enable history?

2> which files i have to modify for the same?
10 REPLIES 10
likid0
Honored Contributor

Re: History not working in root user

just add to you root .profile

something like:

HISTFILE=/.sh_history
export HISTFILE
Windows?, no thanks
Michal Kapalka (mikap)
Honored Contributor

Re: History not working in root user

Hi,

I'm using this settings.

1, root home directory = .profile

2,
export PS1=`hostname`:'$PWD>'
export HISTFILE=./.sh_history
export HISTSIZE=2048

mikap
Ganesan R
Honored Contributor

Re: History not working in root user

Hi,

Does history file(/.sh_history) exist?
#ll /.sh_history

What is the output of #echo $HISTFILE?

root user .profile should contain this.
# grep HISTFILE /.profile
HISTFILE=/.sh_history
export HISTFILE PS1
#
Best wishes,

Ganesh.
Jestin John Chacko
Regular Advisor

Re: History not working in root user

Dear,

# ll .sh_history
-rw------- 1 root sys 1042 Sep 18 2008 .sh_history
# cat .sh_history
vgimport -v -m /tmp/vg02.map vg02 /dev/rdsk/c4t0d0 /dev/rdsk/c4t0d1 /dev/rdsk/c4t0d2 /dev/rdsk/c4t0d3 /dev/rdsk/c6t0d0 /dev/rdsk/c6t0d1 /dev/rdsk/c6t0d2 /dev/rdsk/c6t0d3
xpinfo -i
ioscan
insf
insf -e
vgimport -v -m /tmp/vg02.map vg02 /dev/dsk/c4t0d0 /dev/dsk/c4t0d1 /dev/dsk/c4t0d2 /dev/dsk/c4t0d3 /dev/dsk/c6t0d0 /dev/dsk/c6t0d1 /dev/dsk/c6t0d2 /dev/dsk/c6t0d3
vgchange -a y vg02
vgdisplay -v vg02
vgdisplay -v vg02 |more
fsck -y /dev/vg02/u03
horcmstart.sh 01
export HORCMINST=01
pairdisplay -g wgw1 -l
pairsplit =g wgw1 -swapps
pairmodify
pairsplit -g wgw1
pairdisplay -g wgw1
pairsplit -help
pairdisplay -g wgw1 l
pairresync -g wgw1 -swaps
pairdisplay -g wgw1
pairsplit -g wgw1 -l
pairdisplay -g wgw1
mount /dev/vg02/u03 /u03
fsck -y /dev/vg02/u03
fsck -y /dev/vg02/u04
mount /dev/vg02/u03 /u03
mount /dev/vg02/u03 /u04
mount /dev/vg02/u04 /u04
bdf
bdf
bdf
umount /u03
umount /u04
bdf
pairdisplay -g wgw1
export HORINST=01
pairdisplay -g wgw1
bdf
shutdown -hy 0
# history
sh: fc: Cannot access or open the history file.
#


this is the problem i am facing
Ganesan R
Honored Contributor

Re: History not working in root user

Hi,

Look at the time stamp of .sh_history file.
It is last modified on sept 18 2008.

# ll .sh_history
-rw------- 1 root sys 1042 Sep 18 2008 .sh_history


So some modifications has been done on root's .profile which is pointing to some other history file.

Could you provide the following outputs?

#echo $HISTFILE
#grep HISTFILE /.profile
Best wishes,

Ganesh.
Jestin John Chacko
Regular Advisor

Re: History not working in root user

Dear,

the output of the above script is
# grep HISTFILE /.profile --->no o/p for this
# echo $HISTFILE
sh: HISTFILE: Parameter not setutput of the above files
Michal Kapalka (mikap)
Honored Contributor

Re: History not working in root user

Hi Jestin,

i have one question, how do you log to the system, directly as root or you as some other user and them you make su - ( or just only su ??? )

mikap
Robert-Jan Goossens_1
Honored Contributor
Solution

Re: History not working in root user

Jestin,

remove your .sh_history file it could be corrupted.

# echo $SHELL

if /sbin/sh then

# HISTFILE=/.sh_history
# HISTSIZE=2048
# EDITOR=vi
# export HISTFILE HISTSIZE EDITOR

check if the new sh_history is updated.

Regards,
Robert-Jan
Jestin John Chacko
Regular Advisor

Re: History not working in root user

Dear Robert ,

Thanks for your help the actual problem was the one you mentioned thanks a lot.