PDA

View Full Version : fully automatic remote update



Trial
10-04-20, 11:18
Hi,
I have several boxes spread in my home. I make an update if I am in the mood or want to test something. As I am using a home automation system I thought why not use this to automatically update all my boxes when I am not at home. Telnet or ssh cannot be used directly because they cannot react on the output send by the server. I found that expect as shell is my solution.

Good news is that it works already partly:-)
Bad news is that it only works partly:-(

Here is my script:


#!/usr/bin/expect -f
set timeout -1
set IPaddress "[lindex $argv 0]"
set Username "user"
set Password "pass"

spawn ssh -y-o "StrictHostKeyChecking no" $Username@$IPaddress
expect "*assword: "
send "$Password\r"
expect ":~#"
send "init 4\r"
expect ":~#"
send "opkg update\r"
expect ":~#"
send "opkg upgrade\r"
expect ":~#"
send "reboot\r"
exit

it works perfectly until it enters "opkg upgrade\r" then it does not wait long enough for the reboot and just finishes. The ip of the box is the first parameter when calling this script.

Anyone an idea?

Ralf

abu baniaz
10-04-20, 12:08
Andy posted a command a few years ago which won't get interrupted. I'll ask him, if he remembers.

PLi's options for restoring defaults to yes and has a time-out. If we changed to this, you can flash and restore.

abu baniaz
10-04-20, 13:23
Scrap above post.

Try "init 42". yes, forty two. Should update and reboot automatically.

https://github.com/OpenViX/enigma2/blob/master/tools/enigma2.sh.in#L135

Trial
10-04-20, 18:01
Hi,
this will not help me. I need an external upgrade feature as all my boxes are on a switchable power plug and my home automation software should switch on, upgrade and switch off.

Ralf

goRt
10-04-20, 20:54
Hi,
this will not help me. I need an external upgrade feature as all my boxes are on a switchable power plug and my home automation software should switch on, upgrade and switch off.

RalfInit 42 in a Cron job?

Sent from my ONEPLUS A6003 using Tapatalk

Trial
10-04-20, 22:58
Hi,
boxes are not connected to power so cron impossible.

Ralf