Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug: Losing .zsh_history

On Wed, Oct 5, 2022 at 2:24 PM Dominik Vogt <dominik.vogt@xxxxxx> wrote:
> On Wed, Oct 05, 2022 at 09:05:44PM +0000, Wesley wrote:
> >
> > This might be interesting to read:
> > https://unix.stackexchange.com/a/273869
> Interesting.

Somethig like that is the most likely culprit:  The filesystem has
allocated space for the buffered content to be written out, but
cutting the power brings the system down before the buffer is flushed
to disk.  This is most often seen on "soft-mounted" NFS filesystems
that use delayed writes, but it's certainly possible to happen locally
on abrupt loss of power.

If avoiding FS lossage is important enough to you, you might try
getting a battery power supply unit and configure the power daemon to
do an orderly shutdown if the PS switches to battery.  Then instead of
powering off the machine, unplug the PS.

If the problem merely seems to be that a shell you can't see has
started up and is trying to update the history when it shuts down, you
could add something to .zlogin to make a backup copy of the history
when the shell starts.  The circumstances you've described are odd,
though, because I wouldn't expect a shell to have any opportunity to
begin processing its shutdown when power is cut.  If the same problem
that causes the blank display has already killed the shell, there may
be a connection between the failing display and failing disk

Messages sorted by: Reverse Date, Date, Thread, Author