Command History Storage: enabled but not working :(
-
I'm getting all the signs that command history storage ought to be working:
- .keephistory file in place
- On login it tells me it's working, and how to clear it
- There's even a growing pile of .history.<timestamp> files
Unfortunately:
- all of those files are empty
- on next login, the command history is gone
How to diagnose this?
-
Sounds like you may not be exiting the sessions cleanly so it never writes the history out. Is that possible? I've hit that before when just rebooting or pulling the power.
Steve
-
@stephenw10 Interesting... in my context, almost every "exit" is most definitely not-clean:
- Connecting through SSH, and leave the connection up... and it gets killed every once in a while
- Connecting through a virtual web console. Same thing.
Is there any way to trigger an every-n-minute save? Or even a manual save?
-
I'm not aware of it if there is. Certainly there's no pfSense config for that.
I would try exiting normally and reconnecting just to prove that is the issue before going to deep down that rabbit hole.
Steve
-
@stephenw10 Turns out this is a known and long-festering issue for admins across the board. How to have multiple shells open, all generating history?
Some shells support fancy stuff like eliminating duplicates... but here's the best I have found for pfSense:
Edit ~/.tcshrc and replace
set history = 1000 set savehist = (1000 merge)
with
set history = 1000 set histdup = erase set savehist = (${history} merge lock) alias precmd 'history -S' alias postcmd 'history -M'
So far it works very nicely:
- Saves history after every command
- Merges multiple shell histories together
-