Posted: Wed Aug 15, 2018 13:12 Post subject: Re: save shell history
I'm struggling with the same thing, and can't get command history to save either. It does save on another router that I have, which is running a completely different distro (not DD-WRT), but it has the same version of busybox (installed via opkg). Did anyone ever figure this one out?
mvrk wrote:
Hi,
I'm trying to save shell history to my /jffs partition but isn't working.
I have this in .profile:
export HISTFILE=/jffs/.ash_history
But it doesn't save anything, anyone has any idea?
Not using jffs, I'm using a real HD plugged in via USB. Mounted as /opt (so using entware packages too). I have mapped a new profile over /etc/profile (too override the default /etc/profile). This is done in a startup script, and is documented in the DD-WRT documentation: -
...and it has absolutely no effect on ash writing history (.ash_history never has any history written to it). The .ssh/ directory is working as expected, and knows about all the hosts I've ever SSH'ed to, for example, so there's nothing wrong with /opt/home/root being the home directory. It's almost as if ash has been disabled somehow from writing the .ash_history file. In the same /etc/profile, I also change a bunch of other variables (like the command prompt), so I 100% know it's running and ash is reading it. It just seems to be ignoring the $HISTFILE setting, for no good reason I can see.
egc wrote:
Is there a /jffs partition and is it writable?
you can check with WinSCP
Last edited by home@karlperkins.com on Fri Aug 17, 2018 10:57; edited 2 times in total
There's nothing in my .ash_history. I touched it, to create an empty file, and there's still nothing that ever gets written into it. It's a good suggestion, but there's nothing to copy. It is like ash has somehow been disabled from writing to .ash_history, even though all the right environment variables have been set. See my posting above for more details of how everything is set up.
I've also done some further testing, and copied over an .ash_history from a router running a different distro. From this, I can tell that ash isn't even reading .ash_history, which is quite unexpected. I then installed bash, and it is able to read/write a history file, as you would normally expect.
eibgrad wrote:
Using tomato, I use the shutdown event to copy the contents of .ash_history in the home directory to /jffs, then copy that file back to the home directory in the init event. I imagine you could something similar w/ dd-wrt, although afaik, dd-wrt doesn't have a shutdown event, only the startup event. So perhaps you'd need to periodically copy .ash_history to /jffs using the scheduler.