Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 09-18-2021, 05:45 PM   #1
rolgiati
Zealot
rolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the end
 
Posts: 148
Karma: 31214
Join Date: May 2011
Location: Asuncion (Paraguay)
Device: Several Kindle 3 KB's
Linux bash script for checking the storage on my Kindle 3 Keyboard.

Plagued with storage corruption linked to USB cable that do not make a good contact, I wrote the following to automate the checking of the "disk" when it got corrupted.
May require modifications for more recent Kindles, I would not know as I like the K3, and will not change ;-3)

Code:
   #!/bin/bash
    # Depends on dosfsck

    # This script runs dosfsck on the SD of a Kindle 3 
    # Keyboard after umounting it. 
    # May require adjusting for more recent Kindles. 
    # © Renaud Olgiati 2021 Feel free to copy or modify.
    # Use: connect a Kindle, and launch.

    #Check that the Kindle is connected
    rm -rf tototototo >/dev/null 2>&1
    # Find the device name of the Kindle, abort if none connected.
    df | grep Kindle | gawk  '{print $1}' > tototototo
    if [ ! -s tototototo ] ; then
    echo "No Kindle connected; connect, and re-launch."
    exit 1
    else
    # Check that the script is run as root, if not relaunch with su
      if [ $UID != 0 ]; then
    echo " "
    echo "fsckindle must be run as root."
    su -c "/home/ron/bin/fsckindle" 
    echo " "
    exit 1
      else
    echo "fsckindle now running as Root."
    echo " "
    SD=$(cat tototototo)
    fi
    # umount the Kindle prior to fsck
    umount /dev/$SD >/dev/null 2>&1

    # Run dosfsck 
    # -w will write changes to the disk immediately. 
    # -r will ask you about the repair method, if it has more than one way to fix an inconsistency. 
    # -l will list the names of files being checked; can be useful to determine if there are problems with any particular object. 
    # -a will automatically repair the filesystem. 
    # -v is the verbose mode, which should be helpful. 
    # -t will mark bad clusters, so they aren't used.

    dosfsck -w -r -l -a -v -t /dev/$SD
    echo " "
    echo "Done !"

    # Clean-up
    rm -rf tototototo >/dev/null 2>&1
    fi
    exit 1
rolgiati is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can calibre run a bash script when it's started? Suffolk Punch Calibre 4 04-03-2015 03:55 PM
Linux script for images to Kindle Screensaver soymicmic Kindle Developer's Corner 4 01-28-2011 12:20 PM
Bash Script/SQL Query for ISBN in filename? zenrhino Calibre 1 09-26-2010 09:55 AM
Is it possible to execute a bash script from the SD card? godel10 iRex 25 06-25-2009 04:55 PM
BASH script for *2lrf utilities (thanks Kovid!)... KaiGoth Sony Reader 0 08-05-2007 02:30 AM


All times are GMT -4. The time now is 11:25 AM.


MobileRead.com is a privately owned, operated and funded community.