PDA

View Full Version : Help needed please with cron timer



grantdavey91
14-09-16, 22:58
Hi, All, hoping somebody can help me here

I have been trying this all day!

I and a few friends have created a home page screen which puts it in the place of the bouquet selector (show bouquet on launch) so instead of getting a list of all the bouquets, we get this :

50349

Now, although this looks similar to official sly's homepage for their box, we're not in any way trying to clone the official sly completely, just experimenting with the possibilities of e2 and see how far we can push the GUI and still have it running as it should - it's just a project (note : the images on the screen are visual only - you can't go into them - only function is 'ok' and this takes you to the graphical EPG)

creating this mod hasn't been a problem, and as far as testing it out, it works flawlessly

We decided after creating this mod to try and create a shell script to work with a cron timer on the box to pull images automatically from the web

Well it works, but there are a few issues, mainly only for me grr! i've tried so many things and hoping someone can help me here

At first, the shell script didn't work ; so we used a python file instead to pull a set of images from github and work with the cron timer ; when the cron timer runs, it automatically downloads the images and overwrites existing ones on the box; and it works - to get it to work a python script was created and placed in the filesystem, then it was just a case of creating a cron timer to point to that location e.g. /usr/bin/python /usr/script/toppicks.py

the only problem we are finding with this is that it's not a fully automated solution - in order to change the images and keep them updating to other images, they need to be changed on github by one of us - making it automatic for those using it, but not for the person who has to manually update the images every so often

Today there was a bit of a breakthrough though, it was re-visited and a shell script was created to pull images from an online source which is automatically and regularly updated/changed

to get this to work, the new shell script was placed in the filesystem , then a new cron timer was added to enable the automatic downloads and updates of the screen

Now the problem I have, it's not working for me, although a few of the guys who helped make this possible it is working for them, and i have done exactly the same as them

everything is in the right place, but when i telnet into the box and run the command /usr/script/toppicks2.sh - i get the error "not found" , so instead i tried the command cd /usr/script and then tried ./toppicks2.sh - still "not found" , I then tried /bin/sh /usr/script and i got :

: not found.sh: line 4:
Connecting to www.*****.com (104.65.19.97:80)
htmlpage 100% |*******************************| 105k 0:00:00 ETA
: not found.sh: line 7:
cat: can't open 'htmlpage': No such file or directory
: not found.sh: line 10:
: not found.sh: line 12:
sed: links.txt: No such file or directory
?w=400&h=240&mode=stretch&format=png
'get: bad address '
: not found.sh: line 20:
sed: links.txt: No such file or directory
'get: bad address '
: not found.sh: line 27:
sed: links.txt: No such file or directory
'get: bad address '
: not found.sh: line 34:
sed: links.txt: No such file or directory
'get: bad address '
: not found.sh: line 41:
sed: links.txt: No such file or directory
'get: bad address '

now we know this works, because most others who know what they're doing and have tried it, it's a success, it downloads the images, overwrites the current ones and displays them

I don't know what else to try , I have definitely chmod the files for execution and the path to the relevant files is definitely right, cron jobs are correct currently set up to run daily however by putting the command in telnet that should run it there and then.

Does anybody have any advice? What could I be doing wrong

Is it possible my root filesystem needs to be updated or is there a github source where i could re-install busybox-cron if needed or the sh located in /bin

Thanks in advance for any help, much appreciated

birdman
15-09-16, 02:25
Hi, All, hoping somebody can help me here
...
Does anybody have any advice? What could I be doing wrongThe problem is in the script, not in cron, since it doesn't work from the command line
So post the script here....anything else would just be wild guessing.

grantdavey91
15-09-16, 08:33
I can post the script but I know the script is working because everybody else who has tried it has worked for them it just doesn't seem to work on my duo2 and I have set it up exactly as they have

birdman
15-09-16, 11:23
I can post the script but I know the script is working because ... it just doesn't seem to work on my duo2...So it's clearly not working.

ccs
15-09-16, 12:50
It sounds like the PATH variable isn't set up the same for everyone.

The safest way to make it work is to use full path names in the script, then it should work anywhere, including when called from cron jobs.

grantdavey91
15-09-16, 15:38
So it's clearly not working.

what i am trying to say is that there must some some sort of issue with my duo2, but i am not sure what - i have installed busybox correctly i even unistalled it by using the opkg remove command via telnet and reinstalled and it still didn't work

i am trying to explain that the script isn't the issue because i know a fair few others that have it set up exactly how i have it set up, however for me it's not working - so i was posting here for assistance to establish where the problem could be on my box

i appreciate the responses, although i'm asking for help not sarcasm - i understand how cron / busybox works and i am trying to say it is set up exactly as other users who have this mod running and it's working for them

thanks

grantdavey91
15-09-16, 15:42
It sounds like the PATH variable isn't set up the same for everyone.

The safest way to make it work is to use full path names in the script, then it should work anywhere, including when called from cron jobs.

thanks for your reply, but i have already tried this - i have tried the full path e.g. usr/script/script.sh and i have tried /bin/sh /usr/script/script.sh and /bin/bash /user/script/script.sh

it has chmod 777 for execution , when i type /usr/script/script.sh i get 'not found'

if i put cd /usr/script ./script.sh i get 'not found'

if i put /bin/sh /usr/script/script.sh i get the code as on post one and the same for /bin/bash /usr/script/script.sh

it knows the file is there because i can change the chmod through telnet

and i also have running another cron timer which works fine , as well as a python script ran through cron timers which again is also fine

thanks

ccs
15-09-16, 15:49
... I was referring to full path names within the script itself.

From within telnet,

"which command" tells you where it finds "command" eg which sh

"env" lists all your environment variables.

birdman
15-09-16, 17:29
i am trying to explain that the script isn't the issue ....And I'm trying to explain that without seeing the script I won't have any idea at all what to suggest.
The error message seem to suggest a garbled script (did you leave/put DOS <CR> EOLs on it?), but beyond that I'll have no idea I see it.

grantdavey91
15-09-16, 19:50
... I was referring to full path names within the script itself.

From within telnet,

"which command" tells you where it finds "command" eg which sh

"env" lists all your environment variables.

sorry i misunderstood ,

this is what i get when type those commands


root@vuduo2:~# which command
root@vuduo2:~# which sh
/bin/sh
root@vuduo2:~# which env
/usr/bin/env
root@vuduo2:~# env
MAIL=/var/spool/mail/root
USER=root
SHLVL=1
OLDPWD=/home/root
HOME=/home/root
HUSHLOGIN=FALSE
LC_CTYPE=C.UTF8
PS1=\u@\h:\w\$
LOGNAME=root
TERM=linux
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
SHELL=/bin/sh
PWD=/home/root
EDITOR=/bin/editor
root@vuduo2:~#

grantdavey91
15-09-16, 19:54
And I'm trying to explain that without seeing the script I won't have any idea at all what to suggest.
The error message seem to suggest a garbled script (did you leave/put DOS <CR> EOLs on it?), but beyond that I'll have no idea I see it.

ok no problem, script uploaded to this post

i didn't create the script, a buddy of mine did - wherever the error may be it must be down to my particular box and if it runs differently to another - i know zgemma boxes aren't supported here, but he has the zgemma and works absolutely fine with the same exact setup

i was trying to look at the possibility of looking into learning and re-writing into a python script instead because those seem to work with cron on my box but my brain cannot cope with that haha

birdman
16-09-16, 03:51
ok no problem, script uploaded to this post

The first three commands of the script are:

rm htmlpage
rm htmlpage2
rm htmlpage3but:

The script doesn't first cd to the directory it needs to be running in, so it will run these in the HOME director of the account that is set to run it in cron.
If these files do not exist you will get "Not found" error messages.

So:
add a cd to the working directory at the start, then use:

rm -f htmlpage htmlpage2 htmlpage3
to avoid the errors.

The 3 wget commands have the URL before the options. Whereas this works there are many Linux commands where the options have to come first, so using the same ordering here would be preferable (to get you into good habits).

grep can take a list of files at the end of its options, so you don't need to cat into it (it's a "Useless use of cat").

sort has a -u option, so "sort | uniq" can be replaced with just "sort -u".

The comments say that the greps will be to links3.txt and links2.txt, but the latter is mis-typed as link2s.txt in the actual code.

In the grep search strings, "(http|https)" can be replaced with "https?". (You then wouldn't need the -E option).

You don't need to hard-wire 50 as the random number range (problem if you end up with <50 lines...). Just use "wc -l" to find out how many are actually there.

The location of the skyicons should be parametrized, to makes it simpler to change. Easier to see that they are all the same, and easier to change when testing. You should also check that the directory exists.

The downloads should be in two loops, given that there are only two different commands used.

You need to delete all.txt before running the script a second time - otherwise you'll end up catting it onto itself. (My Linux Mint systems checks this and complains, which is how I spotted it). You might as well delete all the *.txt files you're about to recreate.

But the actual code in the script should run OK. However, it doesn't correspond exactly to the one you had errors with in post1, as that mentions "links.txt", while this script does not. That also mentioned "get" - which makes me wonder if you'd edited it as a text file on an Apple system, then transferred that over. Apple text files are not Linux text files (unless something has changed in the last few years).

Here's a version edited to include these points. You'll need to edit line 4 to set the working directory for your system.

50391

grantdavey91
16-09-16, 19:06
Birdman , thank you so much for taking the time to help with this, very much appreciated

i have downloaded the edited version you provided (thank you) and i changed the directory, however when i run the command now, i get this message:


./toppicks2.sh: line 51: syntax error: unexpected word (expecting "do")

i looked at the file, and "do" is there


toppicks6.png gmanpanthro.png; do

any thoughts?

thanks once again

birdman
16-09-16, 21:13
i have downloaded the edited version you provided (thank you) and i changed the directory, however when i run the command now, i get this message:


./toppicks2.sh: line 51: syntax error: unexpected word (expecting "do")

i looked at the file, and "do" is thereThere's an issue with your editor.
The preceding line ends with a "\" (meaning "continue on next line"), and must not have any trailing whitespace.
You could remove the "\" and put line 51 at the end of line 50 - it's the way it is as I (still) use 80-column wide terminal windows, so tend to write my code accordingly.

grantdavey91
16-09-16, 21:38
There's an issue with your editor.
The preceding line ends with a "\" (meaning "continue on next line"), and must not have any trailing whitespace.
You could remove the "\" and put line 51 at the end of line 50 - it's the way it is as I (still) use 80-column wide terminal windows, so tend to write my code accordingly.

thanks for the reply birdman

i took out the \ but then i got the same error for line 50 :


./toppicks2.sh: line 50: syntax error: unexpected word (expecting "do")

i changed only the line 50/51, originally in your edited .sh, it was set like this :


for name in toppicks1.png toppicks3.png toppicks4.png \
toppicks6.png gmanpanthro.png; do

and i changed it to this :


for name in toppicks1.png toppicks3.png toppicks4.png toppicks6.png gmanpanthro.png; do

i am using a mac, and the program i am using is text wrangler ; if that helps

thanks

birdman
17-09-16, 02:02
i am using a mac, and the program i am using is text wrangler ; if that helpsIt helps me (to know), but I doubt that it's helping you.
In days gone by Mac systems used <CR> as and end of line marker, whereas all Unix/Linux system use <NL> (and MS Windows/DOS uses <CR><NL>). I'm assuming that this still obtains.
Mind you, the BareBones version of TextWrangler claims that it "Transparently reads and writes DOS, Unix, and Mac files".


i took out the \ but then i got the same error for line 50 :The "\" was meant to be there - but it is vital that there are no spaces following it. It must be the final character on the line.

You haven't said what happened when you changed it to be all on one line.

grantdavey91
17-09-16, 18:06
It helps me (to know), but I doubt that it's helping you.
In days gone by Mac systems used <CR> as and end of line marker, whereas all Unix/Linux system use <NL> (and MS Windows/DOS uses <CR><NL>). I'm assuming that this still obtains.
Mind you, the BareBones version of TextWrangler claims that it "Transparently reads and writes DOS, Unix, and Mac files".

The "\" was meant to be there - but it is vital that there are no spaces following it. It must be the final character on the line.

You haven't said what happened when you changed it to be all on one line.

Thanks for the reply

Apologies, when you said remove the '\' i assumed i didn't have to paste it back in after moving line 51 to line 50.

I have amended to place the '\' back in the code, i then ran the command again and was presented with the same error for line 62 :


./toppicks2.sh: line 62: syntax error: unexpected word (expecting "do")

so i placed '\' at the end of line 62 which resolved this one

I then ran the command again and I got :


./toppicks2.sh: line 71: syntax error: unexpected word (expecting "done")

line 71 on the script is literally 'done' wothout the quotation marks

I added '\' thinking this would resolve, but i still got:


./toppicks2.sh: line 71: syntax error: unexpected word (expecting "done")

It's so very close now as it's only complaining about the last line

any ideas?

Thanks

dsayers
17-09-16, 19:32
Try and make it in line with the top line so



wget -q $url1$username$url2$link -O ${dest}/$name
done

I still haven't gòt round to playing with this but hopefully will tonight

grantdavey91
17-09-16, 19:47
Try and make it in line with the top line so



wget -q $url1$username$url2$link -O ${dest}/$name
done

I still haven't gòt round to playing with this but hopefully will tonight

thanks dsayer, just tried that, didn't work unfortunately

birdman
17-09-16, 20:45
Try and make it in line with the top line so This isn't python. It's a shell script and you can format it how you wish to enhance readability.

grantdavey91
17-09-16, 20:52
This isn't python. It's a shell script and you can format it how you wish to enhance readability.

i'm giving everything i can think of a try but not succeeding at the moment, it is literally the very last line it's not happy with saying 'expecting done' but the last line says 'done' and doesn't have any trailing whitespace

birdman
17-09-16, 21:00
Apologies, when you said remove the '\' i assumed i didn't have to paste it back in after moving line 51 to line 50.You shouldn't. But you didn't mention that you'd combined the lines into one.




./toppicks2.sh: line 62: syntax error: unexpected word (expecting "do")

so i placed '\' at the end of line 62 which resolved this oneRemoving an error message does not necessarily mean that you have resolved what was causing it. You've just combined that line with the next one and moved the reported problem elsewhere.

All I can assume is that the fact that you are editing things on a Mac then transferring them onto the box is causing a text formatting problem in the script.
That script runs fine for me on my box, and on my desktop and laptop, which run Linux Mint. It's just a simple shell script.

If you tell me what workdir setting you wish to use I could post a version with that edited in, so you wouldn't need to edit at all and we could see how that gets on.

birdman
17-09-16, 21:04
i'm giving everything i can think of a try but not succeeding at the moment, it is literally the very last line it's not happy with saying 'expecting done' but the last line says 'done' and doesn't have any trailing whitespaceIt should have a trailing newline, though.
I know that some editors think that this isn't needed....

grantdavey91
17-09-16, 21:25
You shouldn't. But you didn't mention that you'd combined the lines into one.

Removing an error message does not necessarily mean that you have resolved what was causing it. You've just combined that line with the next one and moved the reported problem elsewhere.

All I can assume is that the fact that you are editing things on a Mac then transferring them onto the box is causing a text formatting problem in the script.
That script runs fine for me on my box, and on my desktop and laptop, which run Linux Mint. It's just a simple shell script.

If you tell me what workdir setting you wish to use I could post a version with that edited in, so you wouldn't need to edit at all and we could see how that gets on.

sorry, i thought i had mentioned it ; apologies - my brain is just going to mush trying to get this to work

well at first because many others had the same script and it was working for them i assumed it could be something to do with my box, and when i posted up the script i them thought after your reply that the script was wrong even though it was working for some, but i agree and you are more than likely right that its something to do with the editing on mac

by workdir do you mean where the images will be saved? this will bee /usr/share/enigma2/slyk-1-hd/skyicons

or where the script is going to be on the box /usr/script/toppicks2

thanks birdman, really appreciate the help; apologies for my lack of knowledge at this point

birdman
17-09-16, 21:58
by workdir do you mean where the images will be saved? this will bee /usr/share/enigma2/slyk-1-hd/skyicons

or where the script is going to be on the box /usr/script/toppicks2The latter. i.e. the value for workdir in the script.

This one should be all set up for you.

50441

I suggest you copy the zip file into /usr/script/toppicks2 then run

unzip toppicks2.sh.zipto ensure that you have an exact copy of what I have...

ccs
17-09-16, 22:05
..... don't forget to cd /usr/script/toppicks2 before unzipping.

grantdavey91
17-09-16, 22:28
The latter. i.e. the value for workdir in the script.

This one should be all set up for you.

50441

I suggest you copy the zip file into /usr/script/toppicks2 then run

unzip toppicks2.sh.zipto ensure that you have an exact copy of what I have...

LEGEND! IT WORKED!! :)

Birdman, thank you so much for all your help; really appreciate it; I've asked all over the place and got help but no fix

Now I can set up the cron to run it automatically and i'm not going to touch it

but for future purposes for other scripts i may get involved in for the future, would you happen to know if there are any mac based apps/programs I will be able to edit shell on without having the same problem again? no worries if not

thanks again Birdman, I bet it's a relief for you too, I can now stop pestering you haha!

birdman
18-09-16, 02:51
but for future purposes for other scripts i may get involved in for the future, would you happen to know if there are any mac based apps/programs I will be able to edit shell on without having the same problem again? no worries if notThe editor you are using claims to be able to handle Mac, Unix and DOS text files "automatically". Perhaps there is a "Save" option that lets you force the text format?
But there is also the issue of how you then get the files onto the box - you haven't said how you do that.
If you are using FTP then you could either write the file in Unix format then transfer it as a binary file, or write it in Mac format then transfer it as an ASCII/text one.

grantdavey91
18-09-16, 11:29
The editor you are using claims to be able to handle Mac, Unix and DOS text files "automatically". Perhaps there is a "Save" option that lets you force the text format?
But there is also the issue of how you then get the files onto the box - you haven't said how you do that.
If you are using FTP then you could either write the file in Unix format then transfer it as a binary file, or write it in Mac format then transfer it as an ASCII/text one.

I'll have a look to see if it has that possibility - that's a very good point - I only ever save as ASCII/text unless it's already binary ; i'll have a look at the settings/preferences on text wrangler (i'm told it's the best editor for mac and the equivalent of notepad++)

grantdavey91
19-09-16, 17:57
I'll have a look to see if it has that possibility - that's a very good point - I only ever save as ASCII/text unless it's already binary ; i'll have a look at the settings/preferences on text wrangler (i'm told it's the best editor for mac and the equivalent of notepad++)

Hi, birdman

I looked at the text wrangler preferences; I can change to different editors and download additional formats if needed ; the application itself is apparently already saving as unix ; but one thing on this i never noticed before; it has it's own built in script editor which i wasn't using for the shell; just the default text wrangler ; and it also has the function to check syntax before running commands :)

504675046850469

birdman
20-09-16, 02:06
I only ever save as ASCII/text unless it's already binary If it were binary you wouldn't have opened it in TextWrangler...
But you still haven't mentioned how you get the file onto the box.


(i'm told it's the best editor for mac and the equivalent of notepad++)I use a Unix text editor on the box itself...the same one I use on me desktop/laptop - and the same one I've used for the last 25+ years....

grantdavey91
20-09-16, 17:45
If it were binary you wouldn't have opened it in TextWrangler...
But you still haven't mentioned how you get the file onto the box.

I use a Unix text editor on the box itself...the same one I use on me desktop/laptop - and the same one I've used for the last 25+ years....

yeah thats what i mean, if its binary i dont open it; just transfer to box

i get the files onto the box by ftp using filezilla

i wasn't even aware there was a unix editor built into enigma2! where's that? thanks

birdman
20-09-16, 18:40
i wasn't even aware there was a unix editor built into enigma2! where's that? thanks
There appear to be three editors in the packages - joe, nano and vim. None is installed by default.

But I use an old, much modified version of microemacs that we used at work (it ran on every system we ever had). It's what Linus Torvalds uses, except he has a much later version that can handle utf-8 - perhaps one day I'll try to merge the sources....

grantdavey91
23-09-16, 19:53
Hi, Birdman.

Sorry to bring this thread up again.

The same skin mod from the screenshot in page 1 has now been edited with two new shell scripts; and seems to be working again for everyone except those with vu boxes...

I have uploaded the two sh files, would you mind taking a look and adjust as necessary and send them back to me ?

I ran commands through telnet but just getting a bunch of (in my opinion) gibberish i cant get my head around :

telnet results :


Last login: Tue Sep 20 23:09:38 IST 2016 from 192.168.0.5 on pts/0
root@vuduo2:~# cd /usr/script
root@vuduo2:/usr/script# ./toppicks1.sh
-sh: ./toppicks1.sh: not found
root@vuduo2:/usr/script# ./topppicks1.sh
-sh: ./topppicks1.sh: not found
root@vuduo2:/usr/script# ./toppicks2.sh
-sh: ./toppicks2.sh: not found
root@vuduo2:/usr/script# /usr/script/toppicks1.sh
-sh: /usr/script/toppicks1.sh: not found
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 88: syntax error: unexpected end of file (expecting "then")
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 69: syntax error: unexpected end of file (expecting "then")
root@vuduo2:/usr/script# /bin/bash .toppicks1.sh
/bin/bash: can't open '.toppicks1.sh'
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 69: syntax error: unexpected end of file
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 69: syntax error: unexpected "done" (expecting "then")
root@vuduo2:/usr/script# ./toppicks1.sh
-sh: ./toppicks1.sh: not found
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 70: syntax error: unexpected "done" (expecting "then")
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 70: syntax error: unexpected ";"
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 70: syntax error: unexpected ";"
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 70: syntax error: unexpected "done"
root@vuduo2:/usr/script# /bin/bash ./toppicks1.sh
: not found.sh: line 3:
: not found.sh: line 5:
./toppicks1.sh: line 70: syntax error: unexpected end of file
root@vuduo2:/usr/script# /bin/bash ./toppicks2.sh
: not found.sh: line 3:
: not found.sh: line 7:
./toppicks2.sh: cd: line 8: can't cd to /usr/script/scrapes
: not found.sh: line 9:
/premiere.png': No such file or directory-hd/toppicks/picons-base/
./toppicks2.sh: line 12: can't open new.txt: no such file
./toppicks2.sh: line 13: arithmetic syntax error
root@vuduo2:/usr/script#

as you can see i tried to play around with it a bit but had no such luck

attached .sh files are default releases and unchanged; if you can find the error as with the last script, would be greatly appreciated

many thanks in advance

dsayers
23-09-16, 20:40
what happens when using script runner? can you ftp extention create a folder call it what you want ie updatetoppicks then creat a file called plugin.py inside the plugin.py paste these contents



from Plugins.Plugin import PluginDescriptor
from os import system


def main(session, **kwargs):
system('/usr/script/toppicks1.sh &')







################################################## #########################




def Plugins(**kwargs):
return PluginDescriptor(
name="Update Toppics",
description="Update Toppicks files for slyk1hd",
where = PluginDescriptor.WHERE_PLUGINMENU,
fnc=main)


add another file called __init__.py leave it blank

ensure the script is in usr/script

reboot box and see if you can run the plugin

grantdavey91
23-09-16, 20:46
what happens when using script runner? can you ftp extention create a folder call it what you want ie updatetoppicks then creat a file called plugin.py inside the plugin.py paste these contents



from Plugins.Plugin import PluginDescriptor
from os import system


def main(session, **kwargs):
system('/usr/script/toppicks1.sh &')







################################################## #########################




def Plugins(**kwargs):
return PluginDescriptor(
name="Update Toppics",
description="Update Toppicks files for slyk1hd",
where = PluginDescriptor.WHERE_PLUGINMENU,
fnc=main)


add another file called __init__.py leave it blank

ensure the script is in usr/script

reboot box and see if you can run the plugin

thanks for the reply dsayers , ran script runner but i just get 'unexpected end of file'

birdman
23-09-16, 21:11
what happens when using script runner?With errors like those reported it's not going to run anywhere.


root@vuduo2:/usr/script# ./toppicks1.sh
-sh: ./toppicks1.sh: not foundThat, for instance, means that ./toppicks.sh exists and the OS start to run it. It reads the first line (#!/bin/sh) and since that starts with #!, /bin/sh is invoked as the interpreter and passed the script name. But sh can't find that file - despite the fact that it must have been there in order to get to that point!?!

Everything about it seems to indicate to me that the script has been somehow garbled in being copied.

grantdavey9 (http://www.world-of-satellite.com/member.php?76123-grantdavey91), run:


od -c ./toppicks1.sh

and paste the first twenty lines or so here.

grantdavey91
23-09-16, 21:30
With errors like those reported it's not going to run anywhere.


root@vuduo2:/usr/script# ./toppicks1.sh
-sh: ./toppicks1.sh: not foundThat, for instance, means that ./toppicks.sh exists and the OS start to run it. It reads the first line (#!/bin/sh) and since that starts with #!, /bin/sh is invoked as the interpreter and passed the script name. But sh can't find that file - despite the fact that it must have been there in order to get to that point!?!

Everything about it seems to indicate to me that the script has been somehow garbled in being copied.

grantdavey9 (http://www.world-of-satellite.com/member.php?76123-grantdavey91), run:


od -c ./toppicks1.sh

and paste the first twenty lines or so here.

thanks for the reply birdman

ran the command, here's the 1st 30 lines :


root@vuduo2:/usr/script# od -c ./toppicks1.sh
0000000 # ! / b i n / s h \r \n # \r \n \r \n
0000020 u n s e t L D _ P R E L O A D
0000040 \r \n \r \n w o r k d i r = / u s r
0000060 / s c r i p t / s c r a p e s \r
0000100 \n i f [ ! - d " $ w o r
0000120 k d i r " ] ; t h e n \r \n
0000140 m k d i r / u s r / s c r
0000160 i p t / s c r a p e s \r \n f i \r
0000200 \n \r \n c d / u s r / s c r i p
0000220 t / s c r a p e s \r \n \r \n # d e
0000240 s t = / u s r / s h a r e / e n
0000260 i g m a 2 / s l y k - 1 - h d /
0000300 s c r e e n s \r \n # i f [ !
0000320 - d " $ d e s t " ] ; t
0000340 h e n \r \n # e c h o > & 2
0000360 " $ d e s t d o e s n o t
0000400 e x i s t " \r \n # e x i
0000420 t 2 \r \n # f i \r \n \r \n # l a
0000440 r g e p i c k 1 \r \n e c h o
0000460 s c r a p i n g p i c k 1 n
0000500 e w p r e m i e r e s \r \n w g
0000520 e t - q - O n e w " h t
0000540 t p : / / w w w . s k y . c o m
0000560 / t v / c h a n n e l / s k y c
0000600 i n e m a / g a l l e r y / c o
0000620 m i n g - s o o n - t o - s k y
0000640 - c i n e m a - p r e m i e r e
0000660 " \r \n g r e p - E o " h t t
0000700 p : / / w w w . a s s e t 1 . n
0000720 e t / t v / p i c t u r e s / m

thanks for your help on this, i know i keep saying it but it is greatly appreciated :)

birdman
23-09-16, 23:20
thanks for the reply birdman

ran the command, here's the 1st 30 lines :


root@vuduo2:/usr/script# od -c ./toppicks1.sh
0000000 # ! / b i n / s h \r \n # \r \n \r \n


thanks for your help on this, i know i keep saying it but it is greatly appreciated :)Well, there's your problem.

The \r\n (i.e. <CR><LF>).

That file is a DOS text file, not a Unix one. You need to get rid of the <CR>s (\r).

birdman
23-09-16, 23:36
However, back to the actual scripts.


toppicks1.sh:


workdir=/usr/script/scrapes
if [ ! -d "$workdir" ]; then
mkdir /usr/script/scrapes
fi
should really be:

workdir=/usr/script/scrapes
if [ ! -d "$workdir" ]; then
mkdir "$workdir"
fi

toppicks2.sh:
This uses let, which is a bash-only construct, so line one should be #!/bin/bash (in case that isn't a symlink to bash, which it isn't on Vix by default).


if [ $pick == 1 ]; then
should be

if [ $pick -eq 1 ]; then
since you are expecting it to be a number, not text.


if [ $pick == 1 ]; then
.
elif [ $pick == 2 ]; then
.
elif [ $pick == 3 ]; then
.
elseis better done as:

case $pick in
1)
.;;
2)
.;;
3)
.;;
*)
.;;
esac



both:


cd /usr/script/scrapes
should be:

cd /usr/script/scrapes || exit
or

if ! cd /usr/script/scrapes; then
echo >&2 "Failed to reach /usr/script/scrapes"
fisince you shouldn't continue on an error.

grantdavey91
24-09-16, 09:54
However, back to the actual scripts.


toppicks1.sh:


workdir=/usr/script/scrapes
if [ ! -d "$workdir" ]; then
mkdir /usr/script/scrapes
fi
should really be:

workdir=/usr/script/scrapes
if [ ! -d "$workdir" ]; then
mkdir "$workdir"
fi

toppicks2.sh:
This uses let, which is a bash-only construct, so line one should be #!/bin/sh (in base that isn't a symlink to bash, which it isn't on Vix by default).


if [ $pick == 1 ]; then
should be

if [ $pick -eq 1 ]; then
since you are expecting it to be a number, not text.


if [ $pick == 1 ]; then
.
elif [ $pick == 2 ]; then
.
elif [ $pick == 3 ]; then
.
elseis better done as:

case $pick in
1)
.;;
2)
.;;
3)
.;;
*)
.;;
esac



both:


cd /usr/script/scrapes
should be:

cd /usr/script/scrapes || exit
or

if ! cd /usr/script/scrapes; then
echo >&2 "Failed to reach /usr/script/scrapes"
fisince you shouldn't continue on an error.

thanks birdman; would you mind editing the relevant lines and re-upload the scripts as a zip so i can then put on the box and unzip them to /us/script as i did before; i think the main issue is that i am using a mac but with your help on the last script it seemed to work without me needing to open the files

i think its time for me to consider going back to windows

thanks

birdman
24-09-16, 11:04
thanks birdman; would you mind editing the relevant lines and re-upload the scripts as a zipI don't currently have time to test them, but here they are.

50530


i think its time for me to consider going back to windows

thanksThat wouldn't help. The files in the Archive.zip were Unix text files (even though they were created on a Mac). It was the transfer to the Vix box which somehow changed them into DOS text files.
I suspect you'd have the same issue on a transfer from Windows.
But you haven't yet said how you actually get the files onto the Vix box..

grantdavey91
24-09-16, 11:06
I don't currently have time to test them, but here they are.



i think its time for me to consider going back to windows

thanks[/QUOTE]

no probs, there's no rush mate; did you upload the files as i can't see anything attached? thanks

birdman
24-09-16, 11:08
no probs, there's no rush mate; did you upload the files as i can't see anything attached? thanksI pressed the wrong button - and edited it straight afterwards.

grantdavey91
24-09-16, 11:58
I pressed the wrong button - and edited it straight afterwards.

ok no worries, thanks; i'll try it out :)

grantdavey91
24-09-16, 17:40
update sorry for the late response - the source used on the script to resize the pngs, their servers were down earlier so couldn't test fully;

both scripts now work as they should

thanks a lot birdman for all your help; absolute life saver :)

I did also fire up my old windows laptop earlier and tried the default unchanged scripts which does work ; so it's the software i'm using on the mac that's the issue

birdman
25-09-16, 03:17
so it's the software i'm using on the mac that's the issueWell, it's the file-transfer process you're using that's the problem (and you're still giving no hint as to what that is).
If you sent that zip file over to the Vix box an unzipped it there the scripts would be usable.

PS:
grantdavey91 has exceeded their stored private messages quota and cannot accept further messages until they clear some space.

grantdavey91
25-09-16, 11:09
Well, it's the file-transfer process you're using that's the problem (and you're still giving no hint as to what that is).
If you sent that zip file over to the Vix box an unzipped it there the scripts would be usable.

PS:

i thought i did mention how i did it, i just ftp using filezilla; i unzip on the mac, then ftp from the mac to the box using filezilla; but when you say transferring as a zip and unzipping in there, i have tried this and still seems to be an issue for scripts; but the amended scripts you uploaded has worked

I'll sort out my inbox now
thanks