View Single Post
Old 06-17-2012, 02:24 PM   #40
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,615
Karma: 4122230
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
Quote:
Originally Posted by avg_user View Post
Can you tell me if it's possible - let's say that I got a mobile Internet on my Pocketbook 902, I could run a ssh server on it and I could write a script that could connect to this server every 5 minutes and make it run on my router with OpenWRT installed and copy all the notes I have made to the USB disk connected to the router? I'm still looking for a way to synchronize my notes on the fly, and the suggestion to try sshd comes from rkomar in this thread http://www.mobileread.com/forums/sho....php?p=2095215
I think this would be easy to do if OpenWRT has a cron daemon running on it (for scheduling the job every five minutes), and a smarter ftp program like lftp for mirroring directories. You could then write a shell script on the router to check to see if the USB disk is there, make sure the output directory exists, and then mirror the reader's notes to the output directory. Once you've run the script by hand and seen that it works, you could add it to the system's crontab file to run every five minutes between certain hours of the day.

Maybe scp could work in place of the more complicated lftp mirroring program, but I'm not sure if it wouldn't just quit with an error if it tried to copy over an existing file that it got previously.

The problem I see with this is that the reader must have WiFi on at all times while you want synchronization. This will be a serious drain on the battery. Ideally, having a program on the reader that detects when notes have been added or modified and pushes the changes through a brief WiFi session would be best. But it would be a lot more work to get such a system working (on both the reader and the mirroring machine).

Edit: I'm adding a simple script file for using lftp to sync to a directory tree on the reader. You'd have to edit the values of the first four variables to point to the right places for you.

Code:
#!/bin/sh

# Edit these to point to the right places.
NOTESDIR="mnt/ext1/system/config/Active\ Contents"
COPYDIR=/home/robk/tmppb
READERIP=192.168.1.160
PASSWORD="XXX"

CMDS="set net:max-retries 1; set net:timeout 3; open -u reader:$PASSWORD -p 1124 sftp://$READERIP; mirror $NOTESDIR $COPYDIR/"

if [ -d "$COPYDIR" ]; then
  lftp -c "$CMDS"
else
  echo "$COPYDIR does not exist"
fi

Last edited by rkomar; 06-17-2012 at 05:38 PM. Reason: Added script file for lftp.
rkomar is online now   Reply With Quote