Ergebnis 11 bis 17 von 17
-
21.01.2021, 08:37 #11
- Registriert seit
- 27.04.2020
- Beiträge
- 1.485
- Thanks (gegeben)
- 300
- Thanks (bekommen)
- 1098
- Total Downloaded
- 0
- Total Downloaded
- 0
-
Advertising
-
21.01.2021, 22:30 #12
- Registriert seit
- 11.02.2020
- Ort
- here and there
- Beiträge
- 2.444
- Thanks (gegeben)
- 650
- Thanks (bekommen)
- 1661
- Total Downloaded
- 0
- Total Downloaded
- 0
Box 1:Mutant HD2400Box 2:VU Ultimo 4KBox 3:Octagon SF8008Box 4:Gigablue Quad 4KBox 5:VDRHi,
@pmdymidowski
first try this (simple improvements - if we have luck that is enough and it works);
Code:#!/bin/sh BOXIP=http://localhost WGET=/usr/bin/wget LOGDIR=/var/log LOGFILE=$LOGDIR/autoupd_system.log # General Logging. exec 3>&1 4>&2 trap 'exec 2>&4 1>&3' 0 1 2 3 exec 1>$LOGFILE 2>&1 echo -e "\nChecking for system updates, please wait...\n" opkg update > /dev/null #opkg list-upgradable | grep - > /dev/null # i think you didn't need this line the following if line does the job. if ! /usr/bin/opkg list-upgradable | grep - > /dev/null; then echo -e "\nThe system is up to date.\n" else echo -e "\nThe system is being updated, please wait..." $WGET -O - -q "$BOXIP/web/message?text=Trwa%20aktualizacja%20dekodera%2C%20prosze%20czekac%2E%2E%2E&type=1&timeout=12" > /dev/null && sleep 2 echo "-------------------" DATE="$(date +%F_%T)" echo $DATE echo -e "-------------------\n" opkg upgrade if [ "$?" = "0" ] ; then echo -e "\nThe system has been updated, restarting...\n" $WGET -O - -q "$BOXIP/web/message?text=Dekoder%20zostal%20zaktualizowany%2C%20trwa%20ponowne%20uruchamianie%2E%2E%2E&type=1&timeout=12" > /dev/null && sleep 10 else echo -e "\nAn error occurred while updating the system, check the network connection.\n" #$WGET -O - -q "$BOXIP/web/message?text=Wystapil%20blad%20podczas%20aktualizacji%20dekodera%2C%20sprawdz%20polaczenie%20sieciowe%2E&type=3&timeout=20" > /dev/null && sleep 2 $WGET -O - -q "$BOXIP/web/message?text=Wystapil%20blad%20podczas%20aktualizacji%20dekodera%2C%20sprawdz%20polaczenie%20sieciowe%2E&type=3" > /dev/null exit 1 fi #reboot $WGET -q -O - $BOXIP/web/powerstate?newstate=2 fi opkg clean exit 0
echo "-------------------" >> $LOGFILE
anymore - the following is enough then instead;
echo "-------------------"
instead of reboot i use now $WGET -q -O - $BOXIP/web/powerstate?newstate=2 and i think you didn't need a reboot if the script fails (line 31 in the new script)
so in this case the script exits with exit 1 and no reboot.
the messages about webif (wget) are now with timeouts only the error message didn't have a timeout so that you can see this message later if you are not before your box
i maked also a bit cosmetic changes so that the script and the logfile too is better readable.
it's up to you to test it because i didn't
@Mr.Servo
Hmm, na ja so mancher bezeichnet nen Satreceiver aber doch als Decoder (sagt für mich nach wie vor nix bezgl. nem Cam aus).
Und ich schreib das ja nicht zum Spass es deutet ja auch im Script selbst nix darauf hin und da red ich jetzt auch von den Befehlen her.
Um es genauer auszuführen; das Script macht in den Grundzügen eigentlich nur das;
1.) Die Paketliste aktualisieren also das -> opkg update
2.) Gucken obs überhaupt Updates gibts also das -> opkg list-upgradable | grep -
3.) Und dann falls es Updates gibt wird upgedatet also das gemacht -> opkg upgrade
Der Rest sind Logging in ne Datei, sowie Abfragen ob der Hauptbefehl geklappt hat mit Fallunterscheideung also ja oder nein mit entsprechender Reaktion darauf, und natürlich OSD Nachrichten
dazu.
Grüsse
PikeGeändert von Pike_Bishop (21.01.2021 um 23:30 Uhr)
-
Danke - 3 Thanks
-
22.01.2021, 07:42 #13
- Registriert seit
- 10.08.2020
- Ort
- Pfalz / Palatinate
- Beiträge
- 2.656
- Thanks (gegeben)
- 1811
- Thanks (bekommen)
- 2434
- Total Downloaded
- 56,91 MB
- Total Downloaded
- 56,91 MB
Box 1:GigaBlue UHD UE 4k Cable (openATV 7.4)Box 2:Mut@nt HD51 4k Cable (oATV DEVEL)Danke Pike!
Nichts für Ungut, da war ich vielleicht etwas "zu ambitioniert". Aber wir immer: Gut gemeint ist eben nicht gut gemacht!
Danke Dir für das Anpassen des Skripts und die begleitenden Erklärungen. Da kann man sich immer mal was abgucken...
Gruß......Mr.Servo
-
Danke - 1 ThanksPike_Bishop bedankten sich
-
22.01.2021, 20:12 #14
-
22.01.2021, 23:13 #15
- Registriert seit
- 19.01.2021
- Beiträge
- 5
- Thanks (gegeben)
- 0
- Thanks (bekommen)
- 0
- Total Downloaded
- 0
- Total Downloaded
- 0
ThemenstarterThe script will be added to cron. Should it be autoupd_system or autoupd_system.sh? Is an additional parameter required or just add an entry to root?
-
22.01.2021, 23:25 #16
- Registriert seit
- 11.02.2020
- Ort
- here and there
- Beiträge
- 2.444
- Thanks (gegeben)
- 650
- Thanks (bekommen)
- 1661
- Total Downloaded
- 0
- Total Downloaded
- 0
Box 1:Mutant HD2400Box 2:VU Ultimo 4KBox 3:Octagon SF8008Box 4:Gigablue Quad 4KBox 5:VDRuse it as autoupd_system.sh, put it on your box to /usr/script and then make the cronjob.
as example the cronjob can looks as following then;
Code:* * * * * sh /usr/script/autoupd_system.sh
you can do the cronjob with telnet command as following (it's only a example, you need to adjust the parameters for cron in this case the * * * * * in the command;
Code:(crontab -l 2>/dev/null; echo "* * * * * sh /usr/script/autoupd_system.sh") | crontab -
-
23.01.2021, 21:00 #17
- Registriert seit
- 11.02.2020
- Ort
- here and there
- Beiträge
- 2.444
- Thanks (gegeben)
- 650
- Thanks (bekommen)
- 1661
- Total Downloaded
- 0
- Total Downloaded
- 0
Box 1:Mutant HD2400Box 2:VU Ultimo 4KBox 3:Octagon SF8008Box 4:Gigablue Quad 4KBox 5:VDRHi pmdymidowski,
current version looks now as following (it's only for integrity in the forum, because it's the same version as in my last pn);
Code:#!/bin/sh BOXIP=http://localhost WGET=/usr/bin/wget LOGDIR=/var/log LOGFILE=$LOGDIR/autoupd_system.log DATE="$(date +%F_%T)" # General Logging. exec 3>&1 4>&2 trap 'exec 2>&4 1>&3' 0 1 2 3 exec 1>$LOGFILE 2>&1 echo -e "\n-------------------" echo $DATE echo -e "-------------------\n" echo -e "\nChecking for system updates, please wait...\n" opkg update if ! /usr/bin/opkg list-upgradable | grep - ; then echo -e "\nThe system is up to date.\n" else echo -e "\nThe system is being updated, please wait..." $WGET -O - -q "$BOXIP/web/message?text=Trwa%20aktualizacja%20dekodera%2C%20proszę%20czekać%2E%2E%2E&type=1&timeout=12" > /dev/null && sleep 2 opkg upgrade if [ "$?" = "0" ] ; then echo -e "\nThe system has been updated, restarting...\n" $WGET -O - -q "$BOXIP/web/message?text=Dekoder%20został%20zaktualizowany%2C%20trwa%20ponowne%20uruchamianie%2E%2E%2E&type=1&timeout=12" > /dev/null && sleep 10 else echo -e "\nAn error occurred while updating the system, check the network connection.\n" #$WGET -O - -q "$BOXIP/web/message?text=Wystąpił%20błąd%20podczas%20aktualizacji%20dekodera%2C%20sprawdź%20połączenie%20sieciowe%2E&type=3&timeout=20" > /dev/null && sleep 2 $WGET -O - -q "$BOXIP/web/message?text=Wystąpił%20błąd%20podczas%20aktualizacji%20dekodera%2C%20sprawdź%20połączenie%20sieciowe%2E&type=3" > /dev/null exit 1 fi #reboot $WGET -q -O - $BOXIP/web/powerstate?newstate=2 fi opkg clean exit 0
regards
PikeGeändert von Pike_Bishop (23.01.2021 um 21:17 Uhr)
Lesezeichen