PDA

View Full Version : [Mut@nt] HD51 Auto Change Channel Before Going on Standby



ess2k
01-03-18, 13:36
Hi

I would like to set some sort of a channel change shortcut to happen when i press the standby button, so that when i press the standby button, it first changes the channel to say BBC1 and then goes on standby. Is this possible? even though maybe some sort of a script?

Thanks in advance.

ess

Willo3092
01-03-18, 14:06
It's easy to set BBC1 to always be the startup channel if that's what you're trying to achieve?

abu baniaz
01-03-18, 14:33
You cant set a shut down channel. But as in post 2, you can set a start up channel. It doesnt have to be bbc 1.

ess2k
01-03-18, 14:48
Sorry, i should have explained my situation better.

Basically I have some channels as streams setup on my box, and I can have 2 streams simultaneously, also i record streams too. so i wanted the channel to change before standby so that while the box is in standby it isn't using up a stream.

I understand that boot up channel can be set, but that isn't what i am looking for. I read somewhere that the the standby.pyo file can be modified. any ideas or direction would be appreciated.

dsayers
01-03-18, 15:30
I have had a little look but not tested
https://dream.reichholf.net/wiki/Enigma2:WebInterface#Zap

So maybe have a script to zap to BBC 1 then in the standby.py maybe call it on the def __onFirstExecBegin(self): https://github.com/OpenViX/enigma2/blob/7ad14ddf87891f614844afe4235cee24a963989f/lib/python/Screens/Standby.py#L124

I could be totally wrong though

Edit seen this with users running scripts on standby
https://www.domoticz.com/forum/viewtopic.php?f=61&t=2505#p19177

ess2k
01-03-18, 16:03
I have had a little look but not tested
https://dream.reichholf.net/wiki/Enigma2:WebInterface#Zap

So maybe have a script to zap to BBC 1 then in the standby.py maybe call it on the def __onFirstExecBegin(self): https://github.com/OpenViX/enigma2/blob/7ad14ddf87891f614844afe4235cee24a963989f/lib/python/Screens/Standby.py#L124

I could be totally wrong though

Edit seen this with users running scripts on standby
https://www.domoticz.com/forum/viewtopic.php?f=61&t=2505#p19177

WOW! Thanks, why didnt i find that!

Can i please just ask, on the box itself the file ends in pyo and is not editable with notepad, i can download the source .py file from the github (https://github.com/OpenViX/enigma2/tree/master/lib/python/Screens) which is editable but then how do i change the .py back to .pyo?

i am venturing into new territory with linux

Thanks

abu baniaz
01-03-18, 16:06
Always make a backup of the .pyo file first.

Restart and the .py file will compile to .pyo file.

dsayers
01-03-18, 16:11
WOW! Thanks, why didnt i find that!

Can i please just ask, on the box itself the file ends in pyo and is not editable with notepad, i can download the source .py file from the github (https://github.com/OpenViX/enigma2/tree/master/lib/python/Screens) which is editable but then how do i change the .py back to .pyo?

i am venturing into new territory with linux

Thanks

Just visit that github link choose raw and copy all the text and past in notepad++ (standard notepad maybe fine but ++ is better) save as Standby.py do your edits and transfer it Standby.py to \usr\lib\enigma2\python\Screens

Save a copy of the origional .pyo in case it causes issues then you can send it back. Reboot box and the py should compile as .pyo

dsayers
01-03-18, 16:17
Someone may have a better way to check standby in script then if stanby switch channel else exit, you could then have it run in timer every ten minuets this maybe better than editing .py files as it may cause issues when updating the box.

This method looks good
https://www.domoticz.com/forum/viewtopic.php?t=2505#p16305 only issue is I dont have lcd folder this maybe due to me having Uno4k and I have no display

ess2k
01-03-18, 16:20
Thank you guys for all your help, i will be trying this tonight. just a couple final questions so i know exactly what i am doing.

1. when i copy the modded .py to the box, should i delete the .pyo before restart? (i will deffo back it up before i delete)
2. does the compiling take a noticeable amount of time, or should i not notice in change in initial boot up after change? (just asking so i know if it hangs and i can replace original file and that i am not being too hasty)

Thank you soo much, you guys have been an immense help, i will report how i get on after i have had a go.

ccs
01-03-18, 16:25
I'd stop enigma first (init 4) before making changes, and restart with init 3 (they're telnet commands).

Just rename the .pyo file to .pyo.ok

You'll not notice any "compiling" so if it slows down you know it hasn't work.

Take an image backup before you make any changes and put it on a usb stick in case the box stops and you can't telnet in to repair it.

dsayers
01-03-18, 16:25
You can delete it if you want I just normally leave them as I take a backup of them and it shouldn't take much longer to boot

ess2k
01-03-18, 16:28
Thank you very much all, you have been incredibly helpful. I will give this a go tonitght.

ess2k
01-03-18, 16:31
Someone may have a better way to check standby in script then if stanby switch channel else exit, you could then have it run in timer every ten minuets this maybe better than editing .py files as it may cause issues when updating the box.

This method looks good
https://www.domoticz.com/forum/viewtopic.php?t=2505#p16305 only issue is I dont have lcd folder this maybe due to me having Uno4k and I have no display

I will check this method out too, as i have read that an update would overwrite the standby.pyo file, so thank you for this link

birdman
01-03-18, 19:06
Can i please just ask, on the box itself the file ends in pyo and is not editable with notepad,Best not to use notepad for editing anything that is going onto this box anyway. it adds (and expects DOS line endings. The box uses Unix ones.
You could try notepad++ instead (suitably configured).

dsayers
01-03-18, 19:32
I still havent tested this but OpenATV already have something in place for custom standby scripts
https://github.com/openatv/enigma2/commit/f8f20c86f73748ee30564fcb8df66739990b3d26#diff-540acf08816e2c9c140f420d5390a0c1 Maybe Vix can do the same.

Edit they changed to use Console().ePopen instead of os.system
https://github.com/openatv/enigma2/commit/1e54b1be4e2f526fc9b84678a42deaee18fef486#diff-540acf08816e2c9c140f420d5390a0c1

ess2k
01-03-18, 20:49
I still havent tested this but OpenATV already have something in place for custom standby scripts
https://github.com/openatv/enigma2/commit/f8f20c86f73748ee30564fcb8df66739990b3d26#diff-540acf08816e2c9c140f420d5390a0c1 Maybe Vix can do the same.

Edit they changed to use Console().ePopen instead of os.system
https://github.com/openatv/enigma2/commit/1e54b1be4e2f526fc9b84678a42deaee18fef486#diff-540acf08816e2c9c140f420d5390a0c1

hi, So what are the implications of this, what does this means? can i add os.system to the file myself?

Thanks

dsayers
01-03-18, 21:12
hi, So what are the implications of this, what does this means? can i add os.system to the file myself?

Thanks

Yes you can add it yourself I was just giving info for devs to look at so maybe something like this can be standard then users would add there standby scripts to usr/scripts in StandbyEnter.sh and StandbyLeave.sh.

I haven't tested yet but attached is an edited Standby.py FTP Standby.py to \usr\lib\enigma2\python\Screens and save a copy of the .pyo.

Reboot box.

Create your script and call it StandbyEnter.sh and FTP it to usr/scripts when you press stanby it should run the script.

For creating the script test it with script runner first to see if it works.

ess2k
01-03-18, 22:17
@dsayers

Thank you for going through the trouble, I have tried but for some reason i cannot get it to work. I have backups of the origional standby.pyo, deleted it, put your standby.py in, restarted and it created the pyo as expected. i created my script and put it in the correct folder and set correct permissions but nothing happens.

I have but the script in the bin folder and ran the script from putty and it changes the channel, my script is just this,

wget -q -O - http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0

i tried running the script from the usr\scripts folder in putty but keep getting, no such file or directory found, but its there, to try and run the script from that folder i am simply typing in the following, usr/scripts/StandbyEnter.sh

any ideas? ( i am pretty new at this linux commands stuff)

ccs
01-03-18, 22:23
....try /usr/scripts/StandbyEnter.sh rather than usr/scripts/StandbyEnter.sh

dsayers
01-03-18, 22:33
@dsayers

Thank you for going through the trouble, I have tried but for some reason i cannot get it to work. I have backups of the origional standby.pyo, deleted it, put your standby.py in, restarted and it created the pyo as expected. i created my script and put it in the correct folder and set correct permissions but nothing happens.

I have but the script in the bin folder and ran the script from putty and it changes the channel, my script is just this,

wget -q -O - http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0

i tried running the script from the usr\scripts folder in putty but keep getting, no such file or directory found, but its there, to try and run the script from that folder i am simply typing in the following, usr/scripts/StandbyEnter.sh

any ideas? ( i am pretty new at this linux commands stuff)

I have just copied and pasted the wget script and pasted in putty and it zaps to BBC 1 HD, it can also be ran in script runner, menu, setup, vix, script runner choose StandbyEnter.sh

Im currently on OpenATV and they call it Job manager and it runs fine but not when pressing standby.

So I thought I would try another script so in StandbyEnter.sh I put
#!/bin/bash
wget -O /tmp/ABM.xml "https://raw.githubusercontent.com/oe-alliance/AutoBouquetsMaker/master/AutoBouquetsMaker/providers/sat_282_sky_uk.xml" &> /dev/null 2>&1

Pressed standby and it downloaded sat_282_sky_uk.xml to ABM.xml in tmp, so im not sure why it doesnt change change channel on standby

ess2k
01-03-18, 23:10
....try /usr/scripts/StandbyEnter.sh rather than usr/scripts/StandbyEnter.sh

:smiley_yup:

that got the script to run from the folder usr - scripts. thank you for that, i certainly wont forget that / again

ess2k
01-03-18, 23:14
@dsayers

thanks you for all your help, i didnt know what script runner was until now, i ran the script from script runner and it works. again, crazy how 1 script works fine proving the code is correct but this particular script dont.

edit: do you think adding

#!/bin/bash
to the beginning of the script would make a difference?

edit 2- nope, it dont.

birdman
02-03-18, 01:57
I have but the script in the bin folder and ran the script from putty and it changes the channel, my script is just this,

wget -q -O - http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0Whcih won't work, as "?" is an active shell character.
try:

wget -q -O - 'http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0'

ess2k
02-03-18, 10:26
Whcih won't work, as "?" is an active shell character.
try:

wget -q -O - 'http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0'

I really thought this would do the trick, it made perfect sense, but it still won't work

so i tried another script,

grab -d -p /tmp/test.png
Though it works from script runner, it doesnt from standby, i even tried the scripts as StandbyLeave.sh just to test and they still dont run.

could it be a openvix issue?

ess2k
02-03-18, 10:35
just to show what i have done, in case i am doing something wrong,
56256 Standby.py as provided dsayers (thank you)

56257 Modifies StandbyEnter.sh as suggested by birdman ( thank you)

56258 Image of where i am copying file to, and file attrib

56259 Image of where i am copying file to, and file attrib

ccs
02-03-18, 11:06
that got the script to run from the folder usr - scripts. thank you for that, i certainly wont forget that / againIf the script is in the current directory, then ./scriptname is all you need.
The full pathname (the one starting with /usr in your case) will work from any directory.

I'm not sure which the current directory script runner starts up in, so it's best to cd into the one you want at the start of the script.
(Using the full pathname.)

birdman
02-03-18, 13:13
just to show what i have done, in case i am doing something wrong,
56256 Standby.py as provided dsayers (thank you)That code refers to leaving standby, not entering it. You want the bit lower down....(as ccs noted in #20).

ess2k
02-03-18, 13:36
That code refers to leaving standby, not entering it. You want the bit lower down....(as ccs noted in #20).
Hi, I am sure the code for entering standby is there too, i collapsed a couple sections just so i could show the code fro entering standby, if you look at the second half of the image, the text in green it says "use custom script when putting in standby" i am sure this is the correct section for entering standby.

unless I am wrong?

birdman
02-03-18, 14:29
Hi, I am sure the code for entering standby is there too,Ah, sorry. Gave up reading too soon.

The thing to do is to write a script that just echoes some text to a file in /tmp. That will check that the facility is working.
Once that is working, to debug a script that then isn't put this at the top:


#!/bin/sh
#

exec > /tmp/standby.log 2>&1
set -x
...
...your actual code....
...

This will produce a (debug) log of what is happening in /tmp/standby.log and let you figure out what is going wrong.

ess2k
02-03-18, 16:34
Just to make sure to myself I haven't messed up the image, or that i aint going crazy, i just reflashed the box with the latest image and started from scratch,

So then I created a simple script,

#!/bin/bash
touch /tmp/1234.txt

Works fine from script runner, it creates the file 1234 in tmp folder, but nothing when hitting the standby button.

so its either the standby.py file or the image itself.

It cannot be the standby.py file as dsayers has tested it with the autobouquet test and that worked great ( I believe if dsayers re ran the change channel script with the modification mentioned by birdman below it would work)

wget -q -O - 'http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0'

therefore i think i am going to give up as i think this is a openvix image issue.

Anyone else can help it would be appreciated.

i think i might look further into
https://www.domoticz.com/forum/viewtopic.php?t=2505#p16305 but having a quick look at cron job timer, the minimum repeat time is and hour :(

dsayers
02-03-18, 16:57
Sorry I didn't get chance to post yesterday here is a debug log using

wget -q -O - http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0



21:55:51.7667 { } Screens/Standby.py:93 _init_ [Standby] enter standby
21:55:51.7669 [ ] base/console.cpp:110 execute [eConsoleAppContainer] Starting /bin/sh
21:55:51.7683 [ ] dvb/cahandler.cpp:333 unregisterService [eDVBCAService] free slot 0 demux 0 for service 1:0:1:712:12:F020:FFFF0000:0:0:0:
21:55:51.7683 [ ] dvb/cahandler.cpp:497 eDVBCAService [eDVBCAService] free service 1:0:1:712:12:F020:FFFF0000:0:0:0:
21:55:51.7730 [ ] service/servicedvb.cpp:1728 timeshift [eDVBServicePlay] timeshift
21:55:51.7734 [ ] service/servicedvb.cpp:1728 timeshift [eDVBServicePlay] timeshift
21:55:51.7740 [ ] dvb/decoder.cpp:836 setState [eTSMPEGDecoder] decoder state: play, vpid=ffffffff, apid=ffffffff
21:55:51.7741 < > dvb/decoder.cpp:728 stop [eDVBPCR0] DEMUX_STOP ok
21:55:51.7741 [ ] dvb/decoder.cpp:739 eDVBPCR [eDVBPCR0] destroy
21:55:51.7742 < > dvb/decoder.cpp:427 stop [eDVBVideo0] DEMUX_STOP ok
21:55:51.7751 < > dvb/decoder.cpp:436 stop [eDVBVideo0] VIDEO_STOP ok
21:55:51.7789 [ ] dvb/decoder.cpp:528 eDVBVideo [eDVBVideo0] destroy
21:55:51.7790 < > dvb/decoder.cpp:159 stop [eDVBAudio0] AUDIO_STOP ok
21:55:51.7888 < > dvb/decoder.cpp:167 stop [eDVBAudio0] DEMUX_STOP ok
21:55:51.7890 < > dvb/decoder.cpp:203 unfreeze [eDVBAudio0] AUDIO_CONTINUE ok
21:55:51.7983 [ ] dvb/decoder.cpp:247 eDVBAudio [eDVBAudio0] destroy
21:55:51.7984 < > dvb/decoder.cpp:806 stop [eDVBText0] DEMUX_STOP ok
21:55:51.7994 [ ] dvb/decoder.cpp:817 ~eDVBTText [eDVBText0] destroy
21:55:51.8013 [ ] dvb/dvb.cpp:1495 DVBChannelStateChanged [eDVBResourceManager] start release channel timer
21:55:51.9364 { } skin.py:1346 readSkin [SKIN] processing screen Standby:
21:55:51.9379 { } skin.py:1107 readSkin [SKIN] Parsing embedded skin <embedded-in-'StandbySummary'>
21:55:51.9386 { } skin.py:1346 readSkin [SKIN] processing screen <embedded-in-'StandbySummary'>:
21:55:51.9405 { } Screens/Screen.py:151 show [SCREENNAME] StandbySummary
21:55:52.0423 { } Screens/Screen.py:151 show [SCREENNAME] Standby
21:55:52.0566 { } Navigation.py:250 playService playing 1:0:19:1B1D:802:2:11A0000:0:0:0:
21:55:52.0571 { } Components/ServiceList.py:182 setCurrent [servicelist] search for service in userbouquets
21:55:52.0682 [ E ] gdi/accel.cpp:357 accelAlloc [gAccel] accel alloc failed

ess2k
02-03-18, 17:13
Hi dsayers
could you try the script with ' before and after the url so

wget -q -O - 'http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0'

I think that would work for you.

but I just cant get any response what so ever from standby, i think its a vix issue.

What image are you using?

birdman
02-03-18, 17:13
but having a quick look at cron job timer, the minimum repeat time is and hour :(No, it isn't. IIRC that's a limitation of the Vix menu input system.

dsayers
02-03-18, 17:25
Hi dsayers
could you try the script with ' before and after the url so

wget -q -O - 'http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0'

I think that would work for you.

but I just cant get any response what so ever from standby, i think its a vix issue.

What image are you using?

I don't think it's a vix issue I'm currently on OpenATV testing vpn scripts I'll test the above later tonight but as you can see in the debug it's attempting to switch channel but fails.

Maybe there isn't enough time to zap when pressing standby, if I added sleep 4 then repeatedly pressed standby on and off it would switch after turning on. Other wget scripts worked but maybe those services are still active in standby but zapping isn't.

P,s Someone else tested the Standby.py code on vix and it worked I'm not sure what script he used though. Can you turn on debug logging and we can have a look at the debug log after pressing standby.

ess2k
02-03-18, 17:26
No, it isn't. IIRC that's a limitation of the Vix menu input system.

Oh ok, so could I create a cron job using the menu and then adjust the time on it via telnet? if so how please?
Thanks

ccs
02-03-18, 17:33
What would you want the cronjob to do, check if in standby and then zap???

birdman
02-03-18, 17:37
Oh ok, so could I create a cron job using the menu and then adjust the time on it via telnet? if so how please?What time(s) do you want it to run?

dsayers
02-03-18, 17:39
What would you want the cronjob to do, check if in standby and then zap???

Yes this method checks LCD display and echo
https://www.domoticz.com/forum/viewtopic.php?t=2505#p16305 so adjust to zap instead then have it run every 10 minutes. Just a question can you zap whilst in standby? If not then this would be no good.

birdman
02-03-18, 17:40
Maybe there isn't enough time to zap when pressing standbySounds likely. I suspect if you used the original os.system() code it might work, as that will run in the foreground and enigma2 would wait for it.
However, this all indicates (to me) that this isn't the correct way to go.

birdman
02-03-18, 17:48
Basically I have some channels as streams setup on my box, and I can have 2 streams simultaneously, also i record streams too. so i wanted the channel to change before standby so that while the box is in standby it isn't using up a stream.The standby code should be pausing the current service anyway. Have you checked whether things actually currently work?

ess2k
02-03-18, 18:19
What time(s) do you want it to run?

possibly every 10 mins, thanks

dsayers
02-03-18, 18:21
Hi dsayers
could you try the script with ' before and after the url so

wget -q -O - 'http://127.0.0.1/web/zap?sRef=1:0:19:1B1D:802:2:11A0000:0:0:0'

I think that would work for you.



Still the same result



16:47:45.8382 { } Screens/Standby.py:93 __init__ [Standby] enter standby
16:47:45.8385 [ ] base/console.cpp:110 execute [eConsoleAppContainer] Starting /bin/sh
16:47:45.8398 [ ] dvb/cahandler.cpp:333 unregisterService [eDVBCAService] free slot 0 demux 0 for service 1:0:19:5230:812:2:11A0000:0:0:0::ITV Yorkshire HD
16:47:45.8398 [ ] dvb/cahandler.cpp:497 ~eDVBCAService [eDVBCAService] free service 1:0:19:5230:812:2:11A0000:0:0:0::ITV Yorkshire HD
16:47:45.8438 [ ] service/servicedvb.cpp:1728 timeshift [eDVBServicePlay] timeshift
16:47:45.8441 [ ] service/servicedvb.cpp:1728 timeshift [eDVBServicePlay] timeshift
16:47:45.8470 [ ] dvb/decoder.cpp:836 setState [eTSMPEGDecoder] decoder state: play, vpid=ffffffff, apid=ffffffff
16:47:45.8471 < > dvb/decoder.cpp:728 stop [eDVBPCR0] DEMUX_STOP ok
16:47:45.8472 [ ] dvb/decoder.cpp:739 ~eDVBPCR [eDVBPCR0] destroy
16:47:45.8473 < > dvb/decoder.cpp:427 stop [eDVBVideo0] DEMUX_STOP ok
16:47:45.8486 < > dvb/decoder.cpp:436 stop [eDVBVideo0] VIDEO_STOP ok
16:47:45.8529 [ ] dvb/decoder.cpp:528 ~eDVBVideo [eDVBVideo0] destroy
16:47:45.8530 < > dvb/decoder.cpp:159 stop [eDVBAudio0] AUDIO_STOP ok
16:47:45.8616 < > dvb/decoder.cpp:167 stop [eDVBAudio0] DEMUX_STOP ok
16:47:45.8625 < > dvb/decoder.cpp:203 unfreeze [eDVBAudio0] AUDIO_CONTINUE ok
16:47:45.8718 [ ] dvb/decoder.cpp:247 ~eDVBAudio [eDVBAudio0] destroy
16:47:45.8718 < > dvb/decoder.cpp:806 stop [eDVBText0] DEMUX_STOP ok
16:47:45.8730 [ ] dvb/decoder.cpp:817 ~eDVBTText [eDVBText0] destroy
16:47:45.8743 [ ] dvb/dvb.cpp:1495 DVBChannelStateChanged [eDVBResourceManager] start release channel timer
16:47:46.0152 { } skin.py:1346 readSkin [SKIN] processing screen Standby:
16:47:46.0168 { } skin.py:1107 readSkin [SKIN] Parsing embedded skin <embedded-in-'StandbySummary'>
16:47:46.0174 { } skin.py:1346 readSkin [SKIN] processing screen <embedded-in-'StandbySummary'>:
16:47:46.0195 { } Screens/Screen.py:151 show [SCREENNAME] StandbySummary
16:47:46.1219 { } Screens/Screen.py:151 show [SCREENNAME] Standby
16:47:46.1361 { } Navigation.py:250 playService playing 1:0:19:1B1D:802:2:11A0000:0:0:0:
16:47:46.1382 [ E ] gdi/accel.cpp:357 accelAlloc [gAccel] accel alloc failed


But as birdman pointed out service shouldn't be running in standby. So can I suggest whilst on an IPTV channel copy this and past in notepad
http://host:port/panel_api.php?username=uuuu&password=pppp&type=m3u_plus&output=ts

Ensure no other devices are connected to IPTV

Replace host with your IPTV host and port with your IPTV port then uuuu with your username and pppp with your password and past in your web browser you should see a line like this "active_cons":"1".

On your box press standby and refresh your web browser and you should have "active_cons":"0"

Alternatively if you have setup yourself with xtream-editor you can see on your xtream panel if you have an active connection just go to lines

birdman
02-03-18, 18:49
Still the same resultWhat release are you running? That doesn't look like a ViX debug log.

And that log claims that the channel was changed (to an HD one), so what makes you think that it isn't working?


But as birdman pointed out service shouldn't be running in standby.He actually pointed out that it gets paused. I suspect that for a streaming service this just means it remembers the current position, but leaves the network connexions up.
Personally I reckon it would be better to stop a stream when entering standby by default - but then I donlt use them.

So can I suggest whilst on an IPTV channel copy this and past in notepad
http://host:port/panel_api.php?username=uuuu&password=pppp&type=m3u_plus&output=tsDon't use notepad!!!

ess2k
02-03-18, 18:58
You are actually right, it pauses the stream on standby, feel a little embarrassed now. You guys are great though, i have learnt so much. One thing i have managed to do is create a script that hides unwanted bouquets which is great, again thanks to help from you guys on here.

@birdman if you let me know how to modify a cron timer that would be fantastic. i do get how they work, but never tried to modify one. i will search myself too.

Thanks

ccs
02-03-18, 19:00
crontab -e is used to edit crontab entries, but it uses a unix editor (which you can define, but it all gets a bit complicated).

ess2k
02-03-18, 19:08
crontab -e is used to edit crontab entries, but it uses a unix editor (which you can define, but it all gets a bit complicated).

Just tried crontab -e 10 * * * * /usr/scripts/file.sh

and i just get the available options :(

dsayers
02-03-18, 19:10
What release are you running? That doesn't look like a ViX debug log.

Ive already said currently on OpenATV testing OpenVPN scripts ill flash Vix tomorrow, OpenATV uses Console().ePopen but the code in this thread uses os.system ill test both tomorrow



And that log claims that the channel was changed (to an HD one), so what makes you think that it isn't working? It was already on ITV 1 HD the highlighted in red code is the channel (BBC 1 HD) it is meant to Zap to so I thought that wasn't working as when I press standby again its still on ITV 1 HD, sorry if I was wrong as that is how i thought its meant to work.


He actually pointed out that it gets paused. I suspect that for a streaming service this just means it remembers the current position, but leaves the network connexions up.
Personally I reckon it would be better to stop a stream when entering standby by default - but then I donlt use them.

The connection to IPTV does stop at least it does for me tested using
http://host:port/panel_api.php?username=uuuu&password=pppp&type=m3u_plus&output=ts it shows 1 connection when not in standby and 0 connections when in standby


Don't use notepad!!!

Apologise use Notepad ++ although its just editing a web address

ess2k
02-03-18, 19:28
Just tried crontab -e 10 * * * * /usr/scripts/file.sh

and i just get the available options :(

Just figured it out,

type crontab -e
press the insert key to edit
make your changes
press esc to exit edit mode
type :wq to save and exit

:)

birdman
02-03-18, 22:23
Just figured it out,

type crontab -e
press the insert key to edit
make your changes
press esc to exit edit mode
type :wq to save and exit

:)Or not...
I remember an issue about this some 18 months ago. But I also remember seeing some comment about changing cron a month ago. I'll have a look when the TV is free....

birdman
02-03-18, 22:36
One thing I can see with a quick look at the code is that it may not get started when you install it.
Have you rebooted the system since installing it?
Is there a crond process running (telnet in and type "ps -ef").

ess2k
02-03-18, 23:00
One thing I can see with a quick look at the code is that it may not get started when you install it.
Have you rebooted the system since installing it?
Is there a crond process running (telnet in and type "ps -ef").

the closest thing i have to crond is


root 1930 1 0 21:00 ? 00:00:00 /usr/sbin/crond -c /etc/cron/cro

but the cron timer deffo not working, though it says its running in the cron manager and is active on start.

i have restarted a number of times.

birdman
02-03-18, 23:18
Well, if I run crond on my et8000 with the root crontab file (which is in /etc/cron/crontabs) containing:

*/2 * * * * /home/root/cron-test
it runs every two minutes:
Mar 2 22:13:02 et8000 cron.info crond[23654]: crond (busybox 1.24.1) started, log level 8
Mar 2 22:14:00 et8000 cron.info crond[23654]: USER root pid 23695 cmd /home/root/cron-test
Mar 2 22:16:00 et8000 cron.info crond[23654]: USER root pid 23781 cmd /home/root/cron-test

Where is the file you've been editing? Oh, wait - you used crontab -e, so it knows where it is. So what does /var/log/messages contain (since it will report cron jobs running).

ess2k
02-03-18, 23:33
i edited mine from telnet with the command crontab -e
having a look at the location you mention, it seems to have put the cron jobs in a file /etc/cron/crontabs/root and the content of the file is,

10,20,30,40,50,00,45 * * * * /usr/scripts/bouqepg.sh >>/tmp/ten.log
00 * * * * /usr/scripts/bouqepg.sh >> /tmp/hour.log
I tried to get a log going but the log is empty.

but at the following location /ect/cron/ i have 3 crontab files each one containing the same info which is

30 * * * * /usr/bin/ntpdate-sync silent
00 * * * * /usr/scripts/bouqepg.sh

Willo3092
02-03-18, 23:35
I edited the crontabs/root file manually in notepad++ with this:

*/2 * * * * /usr/scripts/StandbyEnter.sh

I then restarted the GUI expecting it to run every 2 minutes but it didn't.
It did however start running every 2 minutes AFTER the hour.
This is how it looks in Cron Manager:

56262

ess2k
02-03-18, 23:38
I edited the crontabs/root file manually in notepad++ with this:

*/2 * * * * /usr/scripts/StandbyEnter.sh

I then restarted the GUI expecting it to run every 2 minutes but it didn't.
It did however start running every 2 minutes AFTER the hour.
This is how it looks in Cron Manager:

56262

Do you have any files in the folder, /ect/cron/

just wondering if they causing a conflict and i should just delete them.

Willo3092
02-03-18, 23:53
The path is /etc/cron/crontabs and there is just the root file and the readme.txt in there.

kokojnr
03-03-18, 00:32
You cant set a shut down channel. But as in post 2, you can set a start up channel. It doesnt have to be bbc 1.Please how do you set a start channel?

Sent from my SM-N910F using Tapatalk

ccs
03-03-18, 00:35
Something like... select the channel you want, press down key, guide appears, press menu, and it's in there somewhere.

birdman
03-03-18, 02:59
i edited mine from telnet with the command crontab -e
having a look at the location you mention, it seems to have put the cron jobs in a file /etc/cron/crontabs/root and the content of the file is,

10,20,30,40,50,00,45 * * * * /usr/scripts/bouqepg.sh >>/tmp/ten.log
00 * * * * /usr/scripts/bouqepg.sh >> /tmp/hour.log
Are you running OpenVix?
The correct file is /etc/cron/crontabs/root and your cron daemon (as seen - a bit truncated - in #52) has been told to look in /etc/cron/crontabs for the file(s).


I tried to get a log going but the log is empty.What log, and how? The /var/log/messages file is always there, and if cron is running it reports each job that it starts there.


but at the following location /ect/cron/ i have 3 crontab files...What are they called?


each one containing the same info which is

30 * * * * /usr/bin/ntpdate-sync silent
00 * * * * /usr/scripts/bouqepg.sh
That first line is the first line of the default root crontab (no idea why it's there, though, as it shouldn't be - but that's for a different thread).

birdman
03-03-18, 03:08
i edited mine from telnet with the command crontab -e
having a look at the location you mention, it seems to have put the cron jobs in a file /etc/cron/crontabs/root and the content of the file is,

10,20,30,40,50,00,45 * * * * /usr/scripts/bouqepg.sh >>/tmp/ten.log
00 * * * * /usr/scripts/bouqepg.sh >> /tmp/hour.logFYI: It's better to put log redirection into the script itself. That way, if you ever want to change it you just edit the script - you don't have to edit the crontab file.

birdman
03-03-18, 03:14
I've just installed cron on my system. I added a command using the ViX cron menu and this line was added to /etc/cron/crontabs/root:
00 * * * * /home/root/gml.shI've edited that line to be:
*/2 * * * * /home/root/gml.shThe /var/log/messages file now shows:
Mar 3 02:03:19 et8000 cron.info crond[31320]: crond (busybox 1.24.1) started, log level 8
Mar 3 02:10:00 et8000 cron.info crond[31320]: USER root pid 31602 cmd /home/root/gml.sh
Mar 3 02:12:00 et8000 cron.info crond[31320]: USER root pid 31669 cmd /home/root/gml.shSo what have you done that breaks it?

ess2k
03-03-18, 11:41
Are you running OpenVix?
The correct file is /etc/cron/crontabs/root and your cron daemon (as seen - a bit truncated - in #52) has been told to look in /etc/cron/crontabs for the file(s).
I am indeed on openvix, the reason for it being truncated is because i deleted the default entry as i thought it was not necessary - should i add it back?


What log, and how? The /var/log/messages file is always there, and if cron is running it reports each job that it starts there.

i was researching and saw a way to create a cron timer log, sorry i didn't realise the default location this log is /var/log/messages i have checked the log, and the cron timer runs as expected - please do forgive me i am new to cron timers especially (but loving them as they are an extremely powerful tool)


What are they called?
each file was called the same, which is crontab.[random-number]


That first line is the first line of the default root crontab (no idea why it's there, though, as it shouldn't be - but that's for a different thread).
i deleted it :rolleyes: sorry. was just trying to trouble shoot.

Now, first i want to thank you for the location of the log, as after checking that I can tell whether the job is running , which it was, so it was a script issue not a cron job issue - I fixed this by removing from the beginning of the script '#!/bin/sh' and just started with the code itself and now it works - hence loving Cron Timers now

Thank you for your patience with me, i knew i hadn't broken much as i had installed a fresh image yesterday.

You and others are a great asset to this forum, and i have learnt a lot from you guys - have tried many images and i must say the tag line from OpenVix is perfect often cloned, never bettered...

ess2k
03-03-18, 11:45
I've just installed cron on my system. I added a command using the ViX cron menu and this line was added to /etc/cron/crontabs/root:

And a big thank you for pointing out the location of the crontab file, editing in notepad++ is 10 times easier than how i was doing it.

birdman
03-03-18, 12:47
each file was called the same, which is crontab.[random-number]Those will be temporary files created by the "crontab -e" command. They should be removed when you exit the command.

birdman
03-03-18, 12:52
i was researching and saw a way to create a cron timer log, sorry i didn't realise the default location this log is /var/log/messages i have checked the log, and the cron timer runs as expected -Good. So is your problem now fixed?

please do forgive me i am new to cron timers...Don't worry. I worked on Unix/Linux systems for >20 years so understand them quite well - haven't any clue about the innards of doing anything on Windows, though.

especially (but loving them as they are an extremely powerful tool)True but, like a hammer, you have to take care not to hit your thumb, and sometimes you need a screwdriver instead.

ess2k
03-03-18, 16:27
Good. So is your problem now fixed?

YES :thumbsup: it is now all sorted, thanks you and dsayers, helped me out a lot. All is now working perfect.
Have a script to hide unwanted bouquets and add service ref to streams to get 7 day EPG - if anyone would like the script let me know, i am more than willing to share.

Next and final mission is to find a way to reorder lines (so i can reorder certain channels) within the same file, maybe it can be done with sed command, but very little info out there on this

I worked on Unix/Linux systems for >20 years

Maybe you could help, please?

I am getting into this unix/linux thing, as it is very intresting and useful, esp with receivers/routers/android ect

birdman
03-03-18, 18:07
Next and final mission is to find a way to reorder lines (so i can reorder certain channels) within the same file, maybe it can be done with sed command, but very little info out there on this

Maybe you could help, please?You mean, given a file Line1...Line10 re-arrange it to, say, Line7, 5, 4, 8, .....?
The problem is defining the criteria for the sorting - highly unlikely that sed (a Stream EDitor) is going to be able to help.

ess2k
03-03-18, 18:16
You mean, given a file Line1...Line10 re-arrange it to, say, Line7, 5, 4, 8, .....?
The problem is defining the criteria for the sorting - highly unlikely that sed (a Stream EDitor) is going to be able to help.

yes, basically. or to use a 'match criteria' to find a line and then move that line and the one below it to the top of the file.

Which command would be best to use?

birdman
03-03-18, 18:52
yes, basically. or to use a 'match criteria' to find a line and then move that line and the one below it to the top of the file.

Which command would be best to use?That specific task is simple in ed. But there is no ed on a Vix system....looking for alternatives.

birdman
03-03-18, 19:42
That specific task is simple in ed. But there is no ed on a Vix system....looking for alternatives.Here's a very specific way....


#!/bin/sh
#
rm -f top end
awk < input '
BEGIN {collect = 0}
/Line3/ {print $0 >> "top";
collect = 1;
next;
}
{if (collect ) {
print $0 >> "top";
collect--;
next}
}
{print $0 >> "end"};
'
cat top end > output
rm -f top endwhich moves the line containing "Line3" and the one following it in input to the top of the file output.

abu baniaz
03-03-18, 19:48
You should really start a new thread for a new topic. Helps people searching for similar solution/situation.

Anyway, bear in mind that entries in the bouquet files can come as part of two lines.

ess2k
03-03-18, 20:21
Here's a very specific way....


#!/bin/sh
#
rm -f top end
awk < input '
BEGIN {collect = 0}
/Line3/ {print $0 >> "top";
collect = 1;
next;
}
{if (collect ) {
print $0 >> "top";
collect--;
next}
}
{print $0 >> "end"};
'
cat top end > output
rm -f top endwhich moves the line containing "Line3" and the one following it in input to the top of the file output.

Amazing! That works perfect, would have taken me months to do that and probably would have given up.

Is there anyway that the changes can be made infile, rather than outputting to a separate file?

ess2k
03-03-18, 20:25
You should really start a new thread for a new topic. Helps people searching for similar solution/situation.

Anyway, bear in mind that entries in the bouquet files can come as part of two lines.

I know, and i actually did try. I created a new thread about cron timers - but no one replied to that. Maybe i will copy the solutions from here and post over there.

ess2k
03-03-18, 23:37
Here's a very specific way....


#!/bin/sh
#
rm -f top end
awk < input '
BEGIN {collect = 0}
/Line3/ {print $0 >> "top";
collect = 1;
next;
}
{if (collect ) {
print $0 >> "top";
collect--;
next}
}
{print $0 >> "end"};
'
cat top end > output
rm -f top endwhich moves the line containing "Line3" and the one following it in input to the top of the file output.

Sorry about this, when i run the code from telnet, it works fine, when i use script runner i get the following error
56280

birdman
04-03-18, 02:49
Sorry about this, when i run the code from telnet, it works fine, when i use script runner i get the following error
56280I was going to post that there is a little bug.

rm -f top endshould be
cp /dev/null top
cp /dev/null endas the files both need to exist even if there is nothing to write to them. This starts both as empty. That would remove the last two error lines (but leave you with an empty outfile file).
Is there anyway that the changes can be made infile, rather than outputting to a separate file?
Change:

cat top end > output
to be

cat top end > inputHowever, neither of these explains why you have an error. But without seeing what you have edited the script to (given that you don't have infile and outfile and aren't looking for Line3) and where you're files are I can't comment.

ess2k
04-03-18, 11:46
the final code i have looks like this:


rm -f top end
awk < /etc/enigma2/userbouquet.1_2.tv '
BEGIN {collect = 0}
/Chan:Name/ {print $0 >> "top";
collect = 1;
next;
}
{if (collect ) {
print $0 >> "top";
collect--;
next}
}
{print $0 >> "end"};
'
cat top end > /etc/enigma2/userbouquet.1_2.tv
rm -f top end

I assume the last 2 error lines are only due to the the awk command not running, if the awk command ran those errors would again disappear, so I think i will leave the code as you originally gave it, saves having extra files.

Above code i have ran in script runner and i still get the same error; I originally had : in the matching text/ channel name and thought maybe it was that what was causing issues, but i have changed that just to normal characters and it is still the same.

birdman
04-03-18, 12:00
I assume the last 2 error lines are only due to the the awk command not running, if the awk command ran those errors would again disappear, so I think i will leave the code as you originally gave it, saves having extra files.No.
If what is being looked for doesn't exist then no top will be written, and if there is nothing other than what is being looked for in the file then no end will be written, so it is important to create empty ones at the start.

birdman
04-03-18, 12:40
Above code i have ran in script runner and i still get the same error;Are you running the same script (i.e. not a copy) one the command line ("in telnet") and through Script runner?
One way I can provoke that error (awk seems happy to let various off syntax through) is to make the awk command line have a DOS text-file line ending.

ess2k
04-03-18, 12:47
No.
If what is being looked for doesn't exist then no top will be written, and if there is nothing other than what is being looked for in the file then no end will be written, so it is important to create empty ones at the start.

Amended to:


cp /dev/null top
cp /dev/null end
awk < /etc/enigma2/userbouquet.1_2.tv '
BEGIN {collect = 0}
/Chan:Name/ {print $0 >> "top";
collect = 1;
next;
}
{if (collect ) {
print $0 >> "top";
collect--;
next}
}
{print $0 >> "end"};
'
cat top end > /etc/enigma2/userbouquet.1_2.tv
rm -f top end

Still the exact same :(

birdman
04-03-18, 12:50
Still the exact same :(Could you post a copy of the file (you'll need to make a zip file of it) here as an attachment?

ess2k
04-03-18, 13:00
Could you post a copy of the file (you'll need to make a zip file of it) here as an attachment?

I take it you mean the script file,

I am leaving all the text in it as is when i run the file.56283

birdman
04-03-18, 13:12
I am leaving all the text in it as is when i run the file.56283That's a DOS text file.
IF you've copied that back to your PC by FTP to attach it to the email, please do it again but using a binary transfer, so that I get an exact copy of what is on the box.

It's also missing the "#!/bin/sh" line at the start (which won't actually stop it running, but does make it more obvious that it's an actual shell script).

ess2k
04-03-18, 13:22
That's a DOS text file.
IF you've copied that back to your PC by FTP to attach it to the email, please do it again but using a binary transfer, so that I get an exact copy of what is on the box.

It's also missing the "#!/bin/sh" line at the start (which won't actually stop it running, but does make it more obvious that it's an actual shell script).

Hi I am sure that is binary transfer, Please see image:
56284

I removed the "#!/bin/sh" myself, as in one of my other scripts that was preventing it from running, having said that, i have tried this script with and wthout "#!/bin/sh" and the results are the same.

ccs
04-03-18, 13:43
.... so you've confirmed the file on your hd51 is DOS format, not unix.

Notepad++ ..... Use option Edit/EOL conversion to sort it out.

nb very last line has no EOL at all.

ess2k
04-03-18, 14:02
.... so you've confirmed the file on your hd51 is DOS format, not unix.

Notepad++ ..... Use option Edit/EOL conversion to sort it out.

nb very last line has no EOL at all.

Thank youuu!!! @css and @birdman

I am sure i have mentioned before that i am exploring new territory with all this. You were right it was a dos file (as the windows option was grayed out) converted it unix and sent to box and now it runs with no error whats so ever!

@birdman

That would remove the last two error lines (but leave you with an empty outfile file).

will these files be overwritten every time the script runs? or will they accumulate?

Thank you so much guys, i think i am almost done!

ccs
04-03-18, 14:04
.... you'll only ever have one copy of each file.

birdman
04-03-18, 16:57
I removed the "#!/bin/sh" myself, as in one of my other scripts that was preventing it from running, having said that, i have tried this script with and wthout "#!/bin/sh" and the results are the same.Well all scripts should start with a "#!" line, as the rest of that line says which interpreter to use to run the script. Historically there only was /bin/sh, so that gets used by default (or if it starts with ": ", which is actually the comment character is sh).

birdman
04-03-18, 17:00
will these files be overwritten every time the script runs? or will they accumulateThey are deleted after creating the output file. Which is why you need to ensure you create empty ones at the start, since their absence may cause an error.

ess2k
04-03-18, 17:25
Well all scripts should start with a "#!" line, as the rest of that line says which interpreter to use to run the script. Historically there only was /bin/sh, so that gets used by default (or if it starts with ": ", which is actually the comment character is sh).

The reason i was getting an error on my other script with "#!/bin/sh" at the beginning, was because it was a dos file and not a unix file. I converted both to unix files and have added "#!/bin/sh" to the beginning and they work fine now.

Thank you for your patience with me, I have learnt a lot.