annuncio

Comprimi
Ancora nessun annuncio.

Oscam Raspberry script per riavvio

Comprimi
X
Comprimi
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  • Filtro
  • Ora
  • Visualizza
Elimina tutto
nuovi messaggi
  • #16

    Re: Oscam Raspberry script per riavvio

    Originariamente inviato da BliNeR-KeY Visualizza il messaggio
    in /etc/init.d/rc.watchdog c_ie hai un altro script vedo

    Ciao Bli,

    si infatti

    il skript e ben lungo....pero se vedi il screenshoot si capisce meglio


    vorrei...almeno compe ho provato ad impostare...che se un reader va in OUT / OFFLinE...il Router (che sarrebbe il mio FRitzbox-server)...fa un restart...fino che tutti Reader sono di nuovo OK....


    Codice PHP:
    #!/bin/sh
    # ZebraDem.com - Freetz Watchdog Addon

    . /etc/init.d/modlibrc
    . /mod/etc/conf/watchdog.cfg

    DAEMON
    =watchdog
    DAEMON_LONG_NAME
    ='ZebraDem/NFR Watchdog'

    get_status() {
    if [ 
    "$WATCHDOG_CHECK_CARDINIT"yes" -"$WATCHDOG_CHECK_CAMRUN"yes" -"$WATCHDOG_CHECK_BULKWRITE"yes" -"$WATCHDOG_CHECK_DYNDNS"yes" ]; then
        
    if [ -"$(pidof crond)" ]; then
        
    if [ -"$(crontab -l 2>/dev/null | grep $DAEMON)" ]; then
        
    return 0
        
    else
        return 
    3
        fi
        
    else
        return 
    3
        fi
        elif 
    [ ! -/tmp/flash/mod/rc.custom ]; then
        
    return 3
        elif 
    [ -"$(grep $DAEMON /tmp/flash/mod/rc.custom)" ]; then
        
    return 0
        
    else
        return 
    3
        fi
    }

    get_ustor() {
        
    USTOR_PATH=''
            
    if [ -/data/watchdog ]; then USTOR_PATH="/data"
            
    elif [ -/cs/watchdog ]; then USTOR_PATH="/cs"
            
    else
        for 
    i in 1 2; do
        
    local USTOR_PATHS="$(mount | grep '/var/media/ftp/' | cut -d ' ' -f3)"
        
    for USTOR in $USTOR_PATHS; do
        if [ -
    "$(ls "$USTOR")" ]; then
        USTOR_PATH
    ="$USTOR"
        
    break
        
    fi
        done
        
    if [ $i -eq 1 ]; then
        
    if [ -"$USTOR_PATH]; then sleep 20; else break; fi
        
    else
        if [ -
    "$USTOR_PATH]; then USTOR_PATH="/var/media/ftp/uStor01"fi
        fi
        done
            fi
        WORKING_DIR
    =${WATCHDOG_LOG_PATH/%uStor%/$USTOR_PATH}
    }

    cleanup() {
        if [ -
    /tmp/flash/mod/rc.custom ]; then
        
    if cat /tmp/flash/mod/rc.custom|grep 'watchdog' >/dev/nullthen
        sed 
    '/watchdog/d' /tmp/flash/mod/rc.custom >/var/tmp/rc.custom.txt
        cat 
    /var/tmp/rc.custom.txt >/tmp/flash/mod/rc.custom
        rm 
    /var/tmp/rc.custom.txt
        modsave flash 
    >/dev/null
        fi
        fi
        
    if [ -"$(pidof crond)" ]; then
        local RESTART_CROND
    ='y'
        
    killall crond
        
    else
        
    local RESTART_CROND='n'
        
    cp /tmp/flash/mod/crontab /var/spool/cron/crontabs/root
        fi
        
    if [ -"$(crontab -l 2>/dev/null | grep $DAEMON)" ]; then
        cat 
    /tmp/flash/mod/crontab grep -v $DAEMON >/tmp/flash/mod/crontab
        cp 
    /tmp/flash/mod/crontab /var/spool/cron/crontabs/root
        
    if [ -"$(crontab -l 2>/dev/null)" ]; then
        
    if [ "$RESTART_CROND"y" ]; then
        
    if [ -"$(pidof crond)" ]; then crond -bfi
        fi
        fi
        fi
    }

    start() {
        
    get_status

        
    case $? in
            0
    )
                echo 
    "Starting ${DAEMON_LONG_NAME} ... already running."
                
    ;;
            
    3)
                echo -
    "Starting ${DAEMON_LONG_NAME} ... "
                
    cleanup
                
    if [ -/tmp/flash/mod/rc.custom ]; then
                
    echo "# BEGIN: $DAEMON>>/tmp/flash/mod/rc.custom
                
    else
                echo 
    "# BEGIN: $DAEMON>/tmp/flash/mod/rc.custom
                fi
                
    echo "/etc/init.d/rc.$DAEMON c_rb" >>/tmp/flash/mod/rc.custom
                
    echo "# END: $DAEMON>>/tmp/flash/mod/rc.custom
                modsave flash 
    >/dev/null
    if [ "$WATCHDOG_CHECK_CARDINIT"yes" -"$WATCHDOG_CHECK_CAMRUN"yes" -"$WATCHDOG_CHECK_BULKWRITE"yes" -"$WATCHDOG_CHECK_DYNDNS"yes" ]; then
                
    if [ -"$(pidof crond)" ]; then killall crondfi
                
    if [ -/tmp/flash/mod/crontab ]; then
                
    echo "# BEGIN: $DAEMON>>/tmp/flash/mod/crontab
                
    else
                echo 
    "# BEGIN: $DAEMON>/tmp/flash/mod/crontab
                fi
                
    if [ "$WATCHDOG_CHECK_CARDINIT"yes" ]; then
                
    echo "*/$WATCHDOG_CHECKING_INTERVAL * * * * /etc/init.d/rc.$DAEMON c_ie" >>/tmp/flash/mod/crontab
                fi
                
    if [ "$WATCHDOG_CHECK_CAMRUN"yes" ]; then
                
    echo "*/$WATCHDOG_CHECKING_INTERVAL * * * * /etc/init.d/rc.$DAEMON c_cr" >>/tmp/flash/mod/crontab
                fi
                            
    if [ "$WATCHDOG_CHECK_BULKWRITE"yes" ]; then
                
    echo "*/$WATCHDOG_CHECKING_INTERVAL * * * * /etc/init.d/rc.$DAEMON c_bw" >>/tmp/flash/mod/crontab
                fi
                
    if [ "$WATCHDOG_CHECK_DYNDNS"yes" ]; then
                
    echo "*/$WATCHDOG_CHECKING_INTERVAL * * * * /etc/init.d/rc.$DAEMON c_dd" >>/tmp/flash/mod/crontab
                fi
                
    echo "# END: $DAEMON>>/tmp/flash/mod/crontab
                cp 
    /tmp/flash/mod/crontab /var/spool/cron/crontabs/root
                
    if [ -"$(pidof crond)" ]; then crond -bfi
                fi

                get_status

                
    case $? in
                    0
    )
                        echo 
    'done.'
                        
    ;;
                    
    3)
                        echo 
    'failed.'
                        
    ;;
                
    esac
                
    ;;
            
    esac
    }

    stop() {
        
    get_status

        
    case $? in
            0
    )
                echo -
    "Stopping ${DAEMON_LONG_NAME} ... "
                
    cleanup
                
    echo 'done.'
                
    ;;
            
    3)
                echo 
    "Stopping ${DAEMON_LONG_NAME} ... not running."
                
    ;;
        
    esac
    }

    transmit_mail() {
        
    mailer -"$DAEMON_LONG_NAME - $ERROR_MSG-f $WATCHDOG_MAIL_FROM -t $WATCHDOG_MAIL_TO -m $WATCHDOG_MAIL_SERVER -a $WATCHDOG_MAIL_USER -w $WATCHDOG_MAIL_PASSWORD

        
    echo "$(date) => transmitted mail to $WATCHDOG_MAIL_TO>>$WORKING_DIR/$DAEMON.log
    }

    check_camrunning() {
        if [ -
    "$ERROR_CAM-"$WATCHDOG_CAM_CAMD3"yes" ]; then
            
    if [ "$(/etc/init.d/rc.camd3 status)" "stopped" ]; then
                local ERROR_CAM
    ='camd3'
            
    fi
        fi

        
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_CCCAM"yes" ]; then
            
    if [ "$(/etc/init.d/rc.cccam status)" "stopped" ]; then
                local ERROR_CAM
    ='cccam'
            
    fi
        fi

        
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_OSCAM"yes" ]; then
            
    if [ "$(/etc/init.d/rc.oscam status)" "stopped" ]; then
                local ERROR_CAM
    ='oscam'
            
    fi
        fi

        
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_OSEMU"yes" ]; then
            
    if [ "$(/etc/init.d/rc.osemu status)" "stopped" ]; then
                local ERROR_CAM
    ='osemu'
            
    fi
        fi

        
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_MPCS"yes" ]; then
            
    if [ "$(/etc/init.d/rc.mpcs status)" "stopped" ]; then
                local ERROR_CAM
    ='mpcs'
            
    fi
        fi

        
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_NEWCS"yes" ]; then
            
    if [ "$(/etc/init.d/rc.newcs status)" "stopped" ]; then
                local ERROR_CAM
    ='newcs'
            
    fi
        fi

            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_SCAM"yes" ]; then
            
    if [ "$(/etc/init.d/rc.scam status)" "stopped" ]; then
                local ERROR_CAM
    ='scam'
            
    fi
        fi

        
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_SBOX"yes" ]; then
            
    if [ "$(/etc/init.d/rc.sbox status)" "stopped" ]; then
                local ERROR_CAM
    ='sbox'
            
    fi
        fi

        
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_GBOX"yes" ]; then
            
    if [ "$(/etc/init.d/rc.gbox status)" "stopped" ]; then
                local ERROR_CAM
    ='gbox'
            
    fi
        fi 


        
    if [ -"$ERROR_CAM]; then
            get_ustor

            
    if [ "$WATCHDOG_DO_CAMRUN"r" ]; then
            local RESTART_OF
    ="router reboot"
            
    else
            
    local RESTART_OF="$ERROR_CAM restart"
            
    fi

            ERROR_MSG
    ="$RESTART_OF - $ERROR_CAM was down"

            
    if [ "$WATCHDOG_DO_CAMRUN!= "r" ]; then /etc/init.d/rc.$ERROR_CAM restartfi
            
    echo "$(date) => $ERROR_MSG>>$WORKING_DIR/$DAEMON.log
            
    if [ "$WATCHDOG_SEND_CAMRUN"yes" ]; then transmit_mailfi
            
    if [ "$WATCHDOG_DO_CAMRUN"r" ]; then /sbin/reboot && exit 0fi
            fi
    }

    check_initerror() {
        
    get_ustor

            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_CAMD3"yes" ]; then
            local CAMD3_LOG_FILE
    =${WATCHDOG_CAM_CAMD3_LOG_FILE/%uStor%/$USTOR_PATH}
            if [ -
    "$(grep "r02 Error activating card$CAMD3_LOG_FILE)" ]; then
            local ERROR_CAM
    ='camd3'
            
    local LOG_FILE=$CAMD3_LOG_FILE
            fi
            fi

            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_CCCAM"yes" ]; then
            local CCCAM_LOG_FILE
    =${WATCHDOG_CAM_CCCAM_LOG_FILE/%uStor%/$USTOR_PATH}
            if [ -
    "$(grep "card init fail$CCCAM_LOG_FILE)" ]; then
            local ERROR_CAM
    ='cccam'
            
    local LOG_FILE=$CCCAM_LOG_FILE
            fi
            fi

            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_OSCAM"yes" ]; then
            local OSCAM_LOG_FILE
    =${WATCHDOG_CAM_OSCAM_LOG_FILE/%uStor%/$USTOR_PATH}
            if [ -
    "$(grep "card initializing error$OSCAM_LOG_FILE)" ]; then
            local ERROR_CAM
    ='oscam'
            
    local LOG_FILE=$OSCAM_LOG_FILE
            fi
            fi

            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_MPCS"yes" ]; then
            local MPCS_LOG_FILE
    =${WATCHDOG_CAM_MPCS_LOG_FILE/%uStor%/$USTOR_PATH}
            if [ -
    "$(grep "card initializing error$MPCS_LOG_FILE)" ]; then
            local ERROR_CAM
    ='mpcs'
            
    local LOG_FILE=$MPCS_LOG_FILE
            fi
            fi

            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_NEWCS"yes" ]; then
            local NEWCS_LOG_FILE
    =${WATCHDOG_CAM_NEWCS_LOG_FILE/%uStor%/$USTOR_PATH}
            if [ -
    "$(grep "Reset failed$NEWCS_LOG_FILE)" ]; then
            local ERROR_CAM
    ='newcs'
            
    local LOG_FILE=$NEWCS_LOG_FILE
            fi
            fi

                    
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_SCAM"yes" ]; then
            local SCAM_LOG_FILE
    =${WATCHDOG_CAM_SCAM_LOG_FILE/%uStor%/$USTOR_PATH}
            if [ -
    "$(grep "card initializing error$SCAM_LOG_FILE)" ]; then
            local ERROR_CAM
    ='scam'
            
    local LOG_FILE=$SCAM_LOG_FILE
            fi
            fi

            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_SBOX"yes" ]; then
            local SBOX_LOG_FILE
    =${WATCHDOG_CAM_SBOX_LOG_FILE/%uStor%/$USTOR_PATH}
            if [ -
    "$(grep "card initializing error$SBOX_LOG_FILE)" ]; then
            local ERROR_CAM
    ='sbox'
            
    local LOG_FILE=$SBOX_LOG_FILE
            fi
            fi

            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_GBOX"yes" ]; then
            local GBOX_LOG_FILE
    =${WATCHDOG_CAM_GBOX_LOG_FILE/%uStor%/$USTOR_PATH}
            if [ -
    "$(grep "Reset failed$GBOX_LOG_FILE)" ]; then
            local ERROR_CAM
    ='gbox'
            
    local LOG_FILE=$GBOX_LOG_FILE
            fi
            fi

            
    if [ -"$ERROR_CAM]; then
            
    if [ "$WATCHDOG_DO_CARDINIT"r" ]; then
            local RESTART_OF
    ="router reboot"
            
    else
            
    local RESTART_OF="$ERROR_CAM restart"
            
    fi

            ERROR_MSG
    ="$RESTART_OF - $ERROR_CAM card initializing error"
            
    /etc/init.d/rc.$ERROR_CAM stop
            
    echo "$(date) => $ERROR_MSG>>$WORKING_DIR/$DAEMON.log
            rm 
    -rf $LOG_FILE
            
    if [ "$WATCHDOG_SEND_CARDINIT"yes" ]; then transmit_mailfi
            
    if [ "$WATCHDOG_DO_CARDINIT"r" ]; then /sbin/reboot && exit 0; else /etc/init.d/rc.$ERROR_CAM startfi
            fi
    }

    check_bulkwrite() {
        
    get_ustor
        
            
    if [ -"$ERROR_CAM-"$WATCHDOG_CAM_OSCAM"yes" ]; then
            local OSCAM_LOG_FILE
    =${WATCHDOG_CAM_OSCAM_LOG_FILE}
            if [ -
    "$(grep "usb bulk write failed$OSCAM_LOG_FILE)" ]; then
            local ERROR_CAM
    ='oscam'
            
    local LOG_FILE=$OSCAM_LOG_FILE
            fi
            fi

            
    if [ -"$ERROR_CAM]; then
            
    if [ "$WATCHDOG_DO_CARDINIT"r" ]; then
            local RESTART_OF
    ="router reboot"
            
    else
            
    local RESTART_OF="$ERROR_CAM restart"
            
    fi

            ERROR_MSG
    ="$RESTART_OF - $ERROR_CAM usb bulk write failed"
            
    /etc/init.d/rc.$ERROR_CAM stop
            
    echo "$(date) => $ERROR_MSG>>$WORKING_DIR/$DAEMON.log
            rm 
    -rf $LOG_FILE
            
    if [ "$WATCHDOG_SEND_BULKWRITE"yes" ]; then transmit_mailfi
            
    if [ "$WATCHDOG_DO_BULKWRITE"r" ]; then /sbin/reboot && exit 0; else /etc/init.d/rc.$ERROR_CAM startfi
            fi
    }

    check_dyndns() {
            
    ERROR_MSG="dsld restart - dynamic DNS problems"
            
    if [ "$(ping -c4 google.de | grep -c seq)" -eq 4 ]; then
            
    if [ "$WATCHDOG_DYNDNS_INTERNAL"yes" ]; then
            local CHECKING_ADDRESS
    ="$(sed 's/.*[ \t]//g' /var/tmp/ddnsstat.txt 2>/dev/null)"
            
    else
            
    local CHECKING_ADDRESS="$WATCHDOG_DYNDNS"
            
    fi
            
    if [ "$(ping -c4 $CHECKING_ADDRESS | grep -c seq)" -ne 4 ]; then
            local RESTART_DSLD
    ='y'
            
    fi
            
    if [ -"$RESTART_DSLD]; then
            get_ustor
            
    echo "$(date) => $ERROR_MSG>>$WORKING_DIR/$DAEMON.log
            
    if [ "$WATCHDOG_SEND_DYNDNS"yes" ]; then transmit_mailfi
            
    /etc/init.d/rc.dsld restart
            fi
            fi
    }

    check_reboot() {
        
    get_ustor

        ERROR_MSG
    ="router reboot"
        
    echo "$(date) => $ERROR_MSG>>$WORKING_DIR/$DAEMON.log
        
    if [ "$WATCHDOG_SEND_REBOOT"yes" ]; then transmit_mailfi
    }


    case $
    1 in
        
    ""|load)
            
    modreg cgi 'watchdog' 'Watchdog'
            
    modreg daemon $DAEMON
            
            
    if [ "$WATCHDOG_ENABLED"yes" ]; then
                start
            
    else
                
    cleanup
                
    echo "${DAEMON_LONG_NAME} is disabled." 1>&2
                
    exit 1
            fi
            
    ;;

        
    unload)
            
    modunreg daemon $DAEMON
            modunreg cgi 
    'watchdog'

            
    stop
            
    ;;

        
    start)
            
    start
            
    ;;

        
    stop)
            
    stop
            
    ;;

        
    restart)
            
    stop
            start
            
    ;;

        
    status)
            
    get_status

            
    case $? in
                0
    )
                    echo 
    'running'
                    
    ;;
                
    3)
                    echo 
    'stopped'
                    
    ;;
            
    esac
            
    ;;

        
    c_cr)
            
    check_camrunning
            
    ;;

        
    c_ie)
            
    check_initerror
            
    ;;

            
    c_bw)
            
    check_bulkwrite
            
    ;;

        
    c_dd)
            
    check_dyndns
            
    ;;

        
    c_rb)
            
    check_reboot
            
    ;;

        *)
            echo 
    "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2
            
    exit 1
            
    ;;
    esac

    exit 


    Watchdog Log-Verzeichnis:
    Prüfintervall:
    Softcam Aktivität prüfen
    Bei Ausfall: Neustart von Softcam Router
    Karten Initialisierung prüfen
    Bei Fehler: Neustart von Softcam Router
    USB (bulkwrite) prüfen
    Bei Fehler: Neustart von Softcam Router
    Dynamic DNS prüfen
    Adresse:
    -->No IRDETo-Files/Keys or communication allowed..... also about CS!!!

    °°OpeNyourEyeS°°

    COMMENTA

    • #17

      Re: Oscam Raspberry script per riavvio

      se non sbaglio questo è lo script che usa IPC?
      Coma ha detto bliner su al amico per webmin.
      bello tu hai webmin installato? se hai webmin è tutto facile a parte devi sapere sempre quello che fai.

      1-provi disabilitare i script in su
      e crea un file .sh e dai destinazione al file.sh che ha postato bliner.
      sono miei quelli script e so che vanno.
      2- hai provato altre oscam se hai lo stesso problema?
      li altri che hanno tuo hardware hanno stesso tuo problema?
      3- installi webmin poi vedrai cose nuove ;)
      Mio Spazio Personale

      codice:
      http://www.bliner-key.com/update/
      Mio Hobby

      - Debian Linux 8 Server (Dedicated Server 8GB -I5)
      - Debian Linux 8 Server On Alix 3d3
      -
      Debian Linux 8 VPS -Virtual Privare Server 30GB-I7
      - DM 7025(da molti anni) 100% ORIGINALE - OoZooN
      - DM 800SE 3 Tuner WIFI A8P -
      OpenATV 6.0
      - DM 800SE ORIGINAL (Prima Versione) OpenATV 6.0
      - Miraclebox Mini PLUS+ EGAMI 8.0 SUPER!!!
      - Cloud Ibox 3 V2
      EGAMI 8.0
      - ZGemma Star H2H & H5 - EGAMI 8.0
      - VU SOLO CLONE - BLACKHOLE 2.1.4

      - Samsung Galaxy S7 SM-G930F
      - TP-LINK ARCHER D2
      - Vodafone Station HG553 (DVA-G3672B)
      - Firewall - Cisco linksys RVS 4000
      - Router - Linksys WAP54 ( DD-WRT)
      - NanoStation M2
      - link 1Gbit x 1Gbit - 750Mbs x 250Mbs - 100Mbs x 100Mbs
      Altro

      Cam; CCcam , Oscam , Unicam , Scam ; ecc.
      Image; Nemesis 2.6 , OpenATV 6.0,EGAMI OE-A 4.0 ;
      Readers; Omnikey , Smargo , Smartmouse+Phoenix , Cas 3;
      Stronzate; 1 Cartone Pieno-Pieno !!!


      LA MIA CONNESSIONE !!! SPERANDO TRA 20 ANNI ARRIVI IN ITALIA ;)



      Consiglio ;
      Non essere stupido pagare ******** !
      Enigma 2 è Gratis!! è lavoro ti Tante Persone e Tanti Team e Tanti Anni !
      Usa OpenATV 5 & EGAMI 7.2 è Super OK = Molto + Stable di Tutte !!!!

      COMMENTA

      Sto operando...
      X