Re: LFS does not save bash history on shutdown
Matthias B. wrote: On Tue, 13 Jun 2006 12:23:03 -0600 Jason Aeschilman [EMAIL PROTECTED] wrote: ash history is not saved on shutdown. I have commented out the line unset HISTFILE from /etc/profile so now history is saved for root, but it only works when I log out of a terminal. If I reboot or shutdown, the history does not get saved to ~/.bash_history. Does anyone know how this can be fixed? Shouldn't this be standard on the LFS system? Even if you keep unset HISTFILE for root, regular users should not lose their bash history on shutdown. Are you sure that you are losing history rather than getting the history for some interactive shell that you had open but didn't use? AFAIK, by default, bash overwrites the history file on exit, i.e. the last shell that terminates gets to write the history. When you shut down, shells terminate in no well-defined order so that with history-overwriting, the shell that wins the race to write history may just be the wrong one. Try putting shopt -s histappend into your /etc/profile and see if that fixes your problem. This will cause bash to append to the history file rather than overwrite it, thereby causing your history to store history from all shells, not just the one terminated last. MSB I have exactly one console session up. So it's not a case where one console is overwriting another. I suppose sending the SIGHUP signal to all bash processes on shutdown may be the best solution. -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: LFS does not save bash history on shutdown
On Tue, 13 Jun 2006 12:23:03 -0600 Jason Aeschilman [EMAIL PROTECTED] wrote: Bash history is not saved on shutdown. I have commented out the line unset HISTFILE from /etc/profile so now history is saved for root, but it only works when I log out of a terminal. If I reboot or shutdown, the history does not get saved to ~/.bash_history. Does anyone know how this can be fixed? Shouldn't this be standard on the LFS system? Even if you keep unset HISTFILE for root, regular users should not lose their bash history on shutdown. Are you sure that you are losing history rather than getting the history for some interactive shell that you had open but didn't use? AFAIK, by default, bash overwrites the history file on exit, i.e. the last shell that terminates gets to write the history. When you shut down, shells terminate in no well-defined order so that with history-overwriting, the shell that wins the race to write history may just be the wrong one. Try putting shopt -s histappend into your /etc/profile and see if that fixes your problem. This will cause bash to append to the history file rather than overwrite it, thereby causing your history to store history from all shells, not just the one terminated last. MSB -- The 1st rule of the Internet: Never trust the Internet. -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: LFS does not save bash history on shutdown
On Thu, Jun 15, 2006 at 01:51:01PM -0600, Jason Aeschilman wrote: Again, I'm just curious how they make this work. I understand your point of view, that you should lose history since you don't explicitly exit the terminal session, but at least some distros have changed it so history is saved on reboot/shutdown, which is the behavior I desire. When your system shuts down, sendsigs script sends first the TERM signal to all processes (that are not in its own process group). Bash blocks this signal (does nothing when it receives it). Then sendsigs sends the KILL signal and all bash instances die immediately, without saving any history information. The easiest way to fix the issue is to send SIGHUP to all Bash processes at shut down. This forces them to write history out and exit. Alternatively you can patch bash to not block SIGTERM, but this may have some nasty effects. -- Tapio -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: LFS does not save bash history on shutdown
S. Anthony Sequeira wrote: On Tue, 2006-06-13 at 12:23 -0600, Jason Aeschilman wrote: Bash history is not saved on shutdown. I have commented out the line unset HISTFILE from /etc/profile so now history is saved for root, but it only works when I log out of a terminal. If I reboot or shutdown, the history does not get saved to ~/.bash_history. Does anyone know how this can be fixed? Shouldn't this be standard on the LFS system? Even if you keep unset HISTFILE for root, regular users should not lose their bash history on shutdown. Jason I believe this is standard. If the terminal session is not logged out of, history for that session is not saved. What I do if I reboot/shutdown from a virtual terminal: reboot ; exit I have lost history enough times, so I'm careful to logout of any session I want to save. Well, this came up because our (very old) Caldera-based system didn't have this problem. I just now tested this on Fedora and it doesn't have this problem either. I'm curious what is different on LFS. I wonder if their reboot command is compiled differently. I suppose one solution would be to create an alias for reboot (alias reboot='reboot; exit') but it seems silly to have to do that. -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: LFS does not save bash history on shutdown
On Thu, 2006-06-15 at 12:24 -0600, Jason Aeschilman wrote: I have lost history enough times, so I'm careful to logout of any session I want to save. Well, this came up because our (very old) Caldera-based system didn't have this problem. I just now tested this on Fedora and it doesn't have this problem either. I'm curious what is different on LFS. I wonder if their reboot command is compiled differently. I suppose one solution would be to create an alias for reboot (alias reboot='reboot; exit') but it seems silly to have to do that. As far as I am aware this is not specific to LFS. I believe Debian bash and cygwin bash exhibits this same behaviour, if the term session is not gracefully shutdown history is lost. Next time I have to reboot one of my Debian servers I will check this out. -- S. Anthony Sequeira ++ Any woman is a volume if one knows how to read her. ++ -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
LFS does not save bash history on shutdown
Bash history is not saved on shutdown. I have commented out the line unset HISTFILE from /etc/profile so now history is saved for root, but it only works when I log out of a terminal. If I reboot or shutdown, the history does not get saved to ~/.bash_history. Does anyone know how this can be fixed? Shouldn't this be standard on the LFS system? Even if you keep unset HISTFILE for root, regular users should not lose their bash history on shutdown. Jason -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
Re: LFS does not save bash history on shutdown
On Tue, 2006-06-13 at 12:23 -0600, Jason Aeschilman wrote: Bash history is not saved on shutdown. I have commented out the line unset HISTFILE from /etc/profile so now history is saved for root, but it only works when I log out of a terminal. If I reboot or shutdown, the history does not get saved to ~/.bash_history. Does anyone know how this can be fixed? Shouldn't this be standard on the LFS system? Even if you keep unset HISTFILE for root, regular users should not lose their bash history on shutdown. Jason I believe this is standard. If the terminal session is not logged out of, history for that session is not saved. What I do if I reboot/shutdown from a virtual terminal: reboot ; exit I have lost history enough times, so I'm careful to logout of any session I want to save. -- S. Anthony Sequeira ++ It's hard to be humble when you're perfect. ++ -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page