View Single Post
Old 06-16-2011, 04:06 PM   #12
niroma
Member
niroma began at the beginning.
 
Posts: 13
Karma: 12
Join Date: Jun 2011
Location: Karlstad, Sweden
Device: PocketBook 902 Pro
Script working from rsh but not from applications!?

Hi,

I have now made a script that works without trouble when executed from the remote shell on the PB902 mentioned above.
Now the problem is that when the script is launched from my "go_get_nwt.app" in the /mnt/ext1/applications folder from the PB902 (not remote), then the hourglass is shown for a couple of seconds and after that the script ends, without downloading anything. Why???

This is the code for go_get_nwt.app
Code:
#!/bin/sh
exec /mnt/ext2/nwtscript/get_nwt.app
and this is for the get_nwt.app
Code:
#!/bin/sh

#Get page containing the list of available newspapers
/mnt/ext1/system/bin/wget --load-cookies /mnt/ext2/nwtscript/cookies.txt http://www1.nwt.se/script/cgiip.exe/WService=nwt/etidning.html -P /var/tmp &> /dev/null

#Extract a list containing only the relevant rows
cat /var/tmp/etidning.html | grep 'http://np.netpublicator.com/netpublication' > /var/tmp/lista.txt

#Extract the newest newspapers id number
tidnnr=$(awk -F'=' 'NR==1 {print substr($2, 45, 9) }' /var/tmp/lista.txt)

#Extract its filename
filnamn=$(awk -F'=' 'NR==1 {print substr($4, 2, length($4)-3)".pdf" }' /var/tmp/lista.txt)

#Download the actual newspaper using built in wget.
wget http://np.netpublicator.com/np/$tidnnr/$filnamn -P /mnt/ext2 &> /dev/null

#Clean up 
rm /var/tmp/lista.txt
rm /var/tmp/etidning.html
I have tested the script row by row using rsh to the PB902 and then it works flawlessly.
niroma is offline   Reply With Quote