![]() |
script comprobación internet, reinicio emu
Lo hice sobre oscam, aunque válido para cualquier emu, en caso que lo queramos utilizar para en caso de desconexion internet pues cuando vuelva la conexion automáticamente nos reinicie la emu:
El script hace: a) comprueba si hay conexion a internet b) Si hay no hace nada, entra en bucle comprobando cada cierto tiempo la conexion mediante ping c) si se pierde, no hace nada, sigue el bucle comprobando cada cierto tiempo la conexion mediante ping d) cuando vuelve la conexion, mata oscam y lo vuelve a arrancar(o la emu que queramos poner) y se vuelve al bucle de comprobacion internet Aqui vemos el log del proceso del script: [CODE]dhcppc0:/usr/script# sh test.shSi hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet ping: bad address 'www.google.es' sh: 1: unknown operand No hay internet, esperamos que vuelva ping: bad address 'www.google.es' sh: 1: unknown operand No hay internet todavia Ya hay Internet, reiniciamos oscam Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet Si hay Internet [/CODE] Y aqui el script para ser utilizado: [CODE]#!/bin/sh while [ true ]; do CUENTA=$(ping -c 1 www.google.es | grep received | awk -F ',' '{print $2}' | awk -F ' ' '{print $1}') if [ $CUENTA = 1 ];then echo "Si hay Internet" else echo "No hay internet, esperamos que vuelva" INTERNET="NO" while [ $INTERNET = NO ]; do CUENTA=$(ping -c 1 www.google.es | grep received | awk -F ',' '{print $2}' | awk -F ' ' '{print $1}') if [ $CUENTA = 1 ];then echo "Ya hay Internet, reiniciamos oscam" INTERNET="SI" killall -9 oscam sleep 1 /var/emu/oscam -b -c /var/etc/oscam else echo "No hay internet todavia" fi done fi sleep 5 done [/CODE] sleep 5---> el tiemp en segundos cada cuanto tiempo queremos que se ejecute |
Este script me lo guardo ;)
Saludos 3usAttcK. |
La franja horaria es GMT +2. Ahora son las 22:06. |
Powered por vBulletin™ Version 3.8.10
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.
Traducido por vBsoporte - vBulletin en español
ZackYFileS - Foros de Debate