console command history
Ernie Luzar
luzar722 at gmail.com
Sat Oct 22 14:41:07 UTC 2016
Adam Vande More wrote:
> On Fri, Oct 21, 2016 at 12:02 PM, Ernie Luzar <luzar722 at gmail.com
> <mailto:luzar722 at gmail.com>> wrote:
>
> Hello List;
>
> After installing from scratch using cdrom.iso the console command
> history is blank for user root. As I issue commands from the root
> command line these commands get added to the history as one would
> expect. After rebooting the system, root's history contains the
> commands I issued before I rebooted the system, and any newly issued
> commands are added to the history as one would expect.
>
> Now here is the problem I am seeing. After any reboots the history
> contains only the issued commands from the first boot after the
> install from scratch. The history does not contain the commands
> issued before the last reboot.
>
>
> This has been the default behavior for quite awhile. If you logout, the
> history will be saved. Whatever entails "shutdown -r now" doesn't
> gracefully logout the shell.
>
> Doing something like "# exit && shutdown -r now" would be a workaround.
>
>
> --
> Adam
Adam:
Thank you. You hit the mail on the head. The original posted problem has
nothing to do with those statements referenced in previous posts in this
thread.
The real problem is the shutdown, halt, and reboot commands just kill
the system which includes the csh shell that the command was issued from
denning the running shell the opportunity to save the current console
command history so it can be restored when the root logs in after the
system is started again.
Issuing exit && reboot or exit && halt or exit && shutdown -p now
from the command line does fix the problem.
I added this this statement in root's .cshrc file
alias sdp "exit && shutdown -p now"
and now when I issue the sdp command from roots shell the history is
saved and restored upon starting the system and logging in as root.
Going to submit a PR to get shutdown, reboot, and halt changed to
gracefully exit the shell the command was issued from.
Thanks for your help in understanding what was really happening here.
More information about the freebsd-questions
mailing list