Operating System - HP-UX
1829102 Members
2584 Online
109986 Solutions
New Discussion

how to save over 1000 commands in .sh_history & not overwrite ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

how to save over 1000 commands in .sh_history & not overwrite ?

My root's .sh_history does not save too many commands even though HISTSIZE=64000. Gets overwritten after few hundred commands ?
Why ?

See below:


#/root ==> cat .sh*|wc -l
206

root's .profile
===============
HISTFILE=/root/.sh_history ; export HISTFILE
print -s "LOGIN - `date '+%m-%d-%E-%H:%M'`"
HISTSIZE=64000 ; export HISTSIZE
ENV=/root/.kshrc; export ENV
EDITOR=vi
export EDITOR
set -o vi

good judgement comes from experience and experience comes from bad judgement.
3 REPLIES 3
Steven E. Protter
Exalted Contributor
Solution

Re: how to save over 1000 commands in .sh_history & not overwrite ?

The usual suscpects in such a case are cron jobs that erase the HISTFILE

I set my size to 5000 and get hundreds of commands.

I would do a crontab -l and start looking for suspects or

find / -exec grep -l 'sh_history' {} \;

That should identify any scripts that are hammering the file.

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
Sammy_2
Super Advisor

Re: how to save over 1000 commands in .sh_history & not overwrite ?

It is the print command doing the hammering .Thansk steve.
good judgement comes from experience and experience comes from bad judgement.
Sammy_2
Super Advisor

Re: how to save over 1000 commands in .sh_history & not overwrite ?

no response needed.thanks
good judgement comes from experience and experience comes from bad judgement.