Superb quality and spec AB-Com PULSe 4K SE. Crazy offer! Only £99! FREE UK DELIVERY! 4K UHD, Enigma 2, Multiboot 4 images & more!...
Superb quality and spec AB-Com PULSe 4K Rev II Twin Satellite tuner only £149! FREE UK DELIVERY! 4K UHD, Enigma 2, SATA HDD facility, Multiboot 4 images & more!...

Help needed please with cron timer

grantdavey91

Forum Supporter
Donated Member
Joined
Feb 8, 2015
Messages
313
Reaction score
0
Points
0
Location
Essex UK
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 :

1_0_1_1656_7E5_2_11A0000_0_0_0.webp

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
 
Hi, All, hoping somebody can help me here
...
Does anybody have any advice? What could I be doing wrong
The 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.
 
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
 
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.
 
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
 
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
 
... 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.
 
Last edited:
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.
 
... 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

Code:
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:~#
 
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
 

Attachments

ok no problem, script uploaded to this post

The first three commands of the script are:
Code:
rm htmlpage
rm htmlpage2
rm htmlpage3
but:
  1. 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.
  2. 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:
Code:
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.

View attachment toppicks2.sh.zip
 
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:

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

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

Code:
toppicks6.png gmanpanthro.png; do

any thoughts?

thanks once again
 
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:

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

i looked at the file, and "do" is there
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.
 
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 :

Code:
./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 :

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

and i changed it to this :

Code:
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
 
i am using a mac, and the program i am using is text wrangler ; if that helps
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".

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.
 
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 :

Code:
./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 :

Code:
./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:

Code:
./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
 
Try and make it in line with the top line so

Code:
    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
 
Try and make it in line with the top line so

Code:
    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
 

OpenViX Feeds Status

Back
Top