View Single Post
Old 05-08-2015, 04:18 AM   #230
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by AlterusPrime View Post
Now about logging. I was wondering if that's possible to log things into some file 'cause i really want to write the script by myself (just to prove something to myself, and, of course, get the task done), could you possibly tell me how to do the logging?
I would do something like this (it is only the basic idea, not the full code)

Spoiler:
Code:
#create name of log file
debug_logfile=/mnt/onboard/wgettest_$(date +%Y%m%d_%H%M%S).log

# only examples
$theurlbase=http://mybooks.com
$targetdir=/mnt/onboard/.books/wgotbooks

#remove index.html if it exists
rm -f $targetdir/index.html

#log what you are going to do
echo "wget -O $targetdir/index.html  $theurlbase/index.html" > $debug_logfile

# do it now for real
wget -O $targetdir/index.html  $theurlbase/index.html

# save the exitcode into a variable
theexitcode=$?

# if exitcode is not 0 log it and exit the script
if [ "$theexitcode" -ne "0" ]; then
  echo "exitcode: $theexitcode" > $debug_logfile
  exit
else
# parse index.html for links
# remove those links that point to files already downloaded earlier
# or if you want to download updated files that have the same filenames as the old ones,
# it seems you have to download all files and compare them to what is already on the device
# [ some code ]
# loop through the links and try downloading them with wget
# log it in the same way as above
# in order to save time during the first trails, maybe write only the log messages
# without actually trying to download
# [some code]
fi


Quote:
Originally Posted by AlterusPrime View Post
UPD2: found the kbterminal thing (why didn't i see it earlier? i think i was blind or tired. or even both.), gotta try to debug my script through this.
I guess kbterminal is not very useful for this task, do it by telnet if this is possible for you.

As for rsync you can find a compiled version in Yet another telnet/sshd & misc tools package... (kobo-stuff-1.3.N-r11910.tar/KoboStuff/KoboRoot/mnt/onboard/.niluje/usbnet/bin)

Last edited by tshering; 05-08-2015 at 04:39 AM.
tshering is offline   Reply With Quote