46
linuxxx
6y

Bought a second hand e-reader and now importing nearly 1k of PDF files into Calibre's library.

Its taking huge amounts of ram and my laptop started freezing.

~$ nano clean.sh

while :
do
sudo sync; echo 3 > /proc/sys/vm/drop_caches
done

~$ chmod +x clean.sh
~$ ./clean.sh

👌

Comments
  • 15
    s/nano/vim/ -.-
  • 0
    What does this do?
  • 14
    Also the kernel cache is useful for performance improvement.. programs load their stuff into RAM so that it doesn't need to be fetched from disk for good reason - it's much faster. And spamming the command like that in a while loop can cause its own performance issues. Use it only once when necessary.

    In my .aliases I have set it like this: alias dropcache='sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"'
    That way I can issue dropcache command when necessary, but only as a last resort when stuff really starts to pile up.
  • 3
    There is a typo. It should be <3
  • 1
    If you want any more books, let me know. I've got about 5000 PDF's and epubs on development, wilderness survival, first aid, all sorts
  • 7
    @zlice Actually I have something like that in the Arch installer script for my dotfiles (https://gitlab.com/irc.condor/...) :3

    install_cronjob(){
    cat >/tmp/rmtmpinfo <<-EOL
    # .info files go here.
    infofiles="/tmp/kernel.info /tmp/icanhazip.info"
    rm \${infofiles}
    EOL
    sudo install -m755 -o root -g root /tmp/rmtmpinfo /etc/cron.hourly/rmtmpinfo
    rm /tmp/rmtmpinfo
    }

    Untested code though.. no idea if it'll work or not. Haven't done a whole lot of work on my dotfiles lately. <<- deals nicely with indentations by the way :)
  • 8
    @zlice Yeah, I ended up migrating the repo to GitLab instead.. the GitHub one is still there, but I'm not pushing to it anymore. I may eventually start pushing to both again but for now my GitLab repo is most up-to-date :)
  • 0
    @Condor s/vim/emacs/
  • 3
    echo will fail, no permission
  • 0
    What make is the e-reader?
  • 0
    @DucksCanCode Care to share the URL for the books?
  • 0
    @kaloxy it's on my data drive rn, I'll put it here when I've set up a public link
Add Comment