Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Command History Storage: enabled but not working :(

    Scheduled Pinned Locked Moved General pfSense Questions
    5 Posts 2 Posters 877 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MrPeteM
      MrPete
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        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

        MrPeteM 1 Reply Last reply Reply Quote 0
        • MrPeteM
          MrPete @stephenw10
          last edited by

          @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?

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            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

            MrPeteM 1 Reply Last reply Reply Quote 0
            • MrPeteM
              MrPete @stephenw10
              last edited by

              @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
              1 Reply Last reply Reply Quote 2
              • rcfaR rcfa referenced this topic on
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.