Skip to content

Instantly share code, notes, and snippets.

@cynicastic
Last active June 15, 2019 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cynicastic/96440e6de6e326fcee84c94a5e45cdac to your computer and use it in GitHub Desktop.
Save cynicastic/96440e6de6e326fcee84c94a5e45cdac to your computer and use it in GitHub Desktop.
Keep shell history in asuswrt with Entware
#!/bin/sh
# File description below copied from https://github.com/RMerl/asuswrt-merlin/wiki/User-scripts#post-mount
#
# Called just after a partition got mounted. The script is passed the mount point (the filesystem path where
# the partition was mounted, e.g. /tmp/mnt/OPT) as an argument which can be used in the script using $1.
#
# If using Diversion (https://www.snbforums.com/threads/diversion-the-router-ad-blocker.48538/),
# shell history (sh) should be turned off when using this script
# If device has entware, link /root to entware /root
ENT="$(find $1/entware/root 2> /dev/null)"
if [ "$ENT" ]; then
rm -rf /tmp/home/root
ln -s /opt/root /tmp/home/root
# also a good place to add cron jobs ("cru a ...") that depend on Entware features
# the example below removes dcd crashes from syslog.log every 10 minutes, DO NOT USE WITH SYSLOG-NG!!!
# cru a dcd_crash "*/10 * * * * /bin/sed -i '/kernel: dcd/,/kernel: x1 /d' /tmp/syslog.log #remove dcd crash lines from syslog"
fi
#eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment