Site Tools


ash_history

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ash_history [2024/09/24 01:28] – created hommeoursporcash_history [2024/10/31 21:52] (current) hogwild
Line 1: Line 1:
-By default the command line history is kept as long as you don't reboot or power off your router. It is possible to make it persistent by using permanent storage like JFFS or a USB attached storage.+====== Make command line history persistent ======
  
-The commands history is kept in ''/tmp/home/root/.ash_history''+By default, the command line history is stored as long as you don't reboot/power off the router. However, You can make it persistent by using permanent storage, such as JFFS or USB attached storage.
  
-We can use FreshTomato ability to execute script at boot and at shutdown to backup and restore the commands history to make it persistent across rebootsTo do so, we need 2 scripts. One that will execute on shutdown to backup the history to permanent storage and another one to restore the history on boot.+The command history is kept in: "/tmp/home/root/.ash_history".
  
-\\ This shutdown script will save the last 100 used commandsIf you want to keep more, change '100' with the number of your choice. +FreshTomato can execute a script at boot and at shutdown to backup and restore the command history to make it persistent across reboots. To achieve this, we need 2 scripts. One script will execute at shutdown to backup the history to permanent storage. The other will restore the history on boot. 
-Name your backup script ''cli_history_save.autostop'' and use the following code:+ 
 + \\ \\ This shutdown script will save the last 100 commands used. \\ To save more, change '100' to whatever number you wish\\ Name your backup script "cli_history_save.autostopand use \\ the following code:
  
 <code bash cli_history_save.autostop> <code bash cli_history_save.autostop>
Line 14: Line 15:
 </code> </code>
  
-\\ The second script will restore the history when booting.\\ Name your restore script ''cli_history_restore.autorun''+ \\ \\ The second script will restore the command history when booting.\\ Name your restore script "cli_history_restore.autorun":
  
 <code bash cli_history_restore.autorun> <code bash cli_history_restore.autorun>
Line 22: Line 23:
 </code> </code>
  
-\\ Make sure to place the scripts in the storage mount directory, i.e. ''/jffs'' for JFFS or ''/tmp/mnt/sda1'' for USB (replace 'sda1with the name of the partition)Also make the scripts executable with ''chmod''.+ \\ \\ You must place the scripts in the mounted storage directory,  \\ (such as "/jffsfor JFFS or "/tmp/mnt/sda1for USB). \\ Replace "sda1with your actual partition nameThen, make the scripts \\ executable with chmod:
  
 <code bash> <code bash>
 chmod +x cli_history_save.autostop cli_history_restore.autorun chmod +x cli_history_save.autostop cli_history_restore.autorun
 </code> </code>
 +
 + \\ \\  \\
  
  
ash_history.1727137691.txt.gz · Last modified: 2024/09/24 01:28 by hommeoursporc