Resultados 1 a 5 de 5

Script para correr 2 Cccam em simultaneo

  1. #1
    Gforum Dedicado Avatar de obelix699
    Registo: May 2007
    Posts: 386

    Padrão Script para correr 2 Cccam em simultaneo

    Eu ja tinha postado este script noutro topico mas aqui fica arrumadinho :-)


    More then 1 CCcam on same PC with differend nodeid

    '' Its about more then one CCcam on 1 PC and i have to say i tested i just on a pc and not on a dreambox,
    with in my case Ubuntu installed on it, but it works on more linux distro's , centos , debian and so on..
    I did read a lot of requests on differend forums about more then 1 CCcam's on the same PC,
    and because of everyone who was trying, had the same problem and that are that the CCcams running
    on the same PC had the same NodeID.
    When you do this you have to set differend ports for every CCcam!!
    And i had some sparetime for my hobby anyway, so i took a shot at it and solved the problem.
    First we have to name all the CCcam's like this CCcam_1.x86 and the config like CCcam_1.cfg and so on.
    the .x86 is important or sometimes the cam's won't start. So don't change that if you want to use it.
    the CCcam's starting is done like this. /usr/local/bin/CCcam_1.x86 -C /var/etc/CCcam_1.cfg
    So now the trick, when i was testing i saw the same nodeid no big suprice because everyone did know that.
    What happens is that when you start CCcam it writtes down the nodeid in /tmp/ like /tmp/.CCcam.nodeid
    But when you start the second CCcam it takes over the Nodeid from CCcam that started befor.
    so i thought what will happen when i delete the nodeid from the CCcam when it is running,
    so i did and there was nothing changed CCcam was still running perfect without any problems so i started the second CCcam
    and it had a new and differend nodeid so problem solved ! easy ??? yes !!
    But when you have to start al the cam's al the time manualy then you have a big job, so i made some nice small
    scripts to run it all easely to start, stop, check the cam's running and config updates.
    Bud you have to make some new directory's
    /var/cccamlog for the logfiles /var/scripts for the scripts and /var/config and /var/backup for the config files
    the script makes a backup from the config befor the last changes.
    in some scripts you have to fill in your username from the distro that you use. on the plases with ?????????
    and what to do to remove the nodeid is the command :

    chown yourusername /tmp/.CCcam.nodeid ----> to get the rights to remove the file.

    Then the remove and start command:

    rm /tmp/.CCcam.nodeid && /usr/local/bin/CCcam_2.x86 -C /var/etc/CCcam_2.cfg

    and this you need to do for all the next to start CCcam's. i have tested it till 10 CCcam's just for fun.
    the script are made easy to add extra lines colored in yellow for each extra CCcam you add.
    all the Cam's and configs can be in the same directory's configs in /var/etc/ and the cam's /usr/local/bin/
    a few things, each CCcam needs a differend CardReader but the CCcam,s can share the same *** files.
    when you want to use moer Cccams then 3 you have to change some lines.

    chmod 755 the scripts

    to start the cam's from reboot from the pc ,set the line in /etc/rc.local :
    /var/script/MoreCCcamstart.sh
    and to use the configupdate script . you better do like this first stop the cam's compleet!
    then do configupdate then start the cam's again and use thise times because of the check script.
    crontab -e
    56 03 * * * /var/script/MoreCCcamstop.sh
    57 03 * * * /var/script/MoreConfigUpdate.sh
    58 03 * * * /var/script/MoreCCcamstart.sh
    */5 * * * * /var/script/MoreCCcamCheck.sh

    ************************************************** ****************************

    ################################################## #################################################
    script name MoreCCcamCheck.sh
    ################################################## #################################################
    #!/bin/sh
    #Script to check if the CCcam's are running.
    #Script is written by Youknowhoo.
    process=`ps auxwww | grep CCcam_1.x86 | grep -v grep | awk '{print $1}'`
    if [ -z "$process" ]; then
    echo "Couldn't find CCcam_1.x86 running.removing nodeid and Restarting CCcam Server" >> /var/cccamlog/cccam.check
    echo && date >> /var/cccamlog/cccam.check
    chown root /tmp/.CCcam.nodeid
    rm /tmp/.CCcam.nodeid && /usr/local/bin/CCcam_1.x86 -C /var/etc/CCcam_1.cfg
    else echo "CCcam_1.x86 is still OK!" >> /var/cccamlog/cccam.check
    fi
    process=`ps auxwww | grep CCcam_2.x86 | grep -v grep | awk '{print $1}'`
    if [ -z "$process" ]; then
    echo "Couldn't find CCcam_2.x86 running.removing nodeid and Restarting CCcam Server" >> /var/cccamlog/cccam.check
    echo && date >> /var/cccamlog/cccam.check
    chown root /tmp/.CCcam.nodeid
    rm /tmp/.CCcam.nodeid && /usr/local/bin/CCcam_2.x86 -C /var/etc/CCcam_2.cfg
    else echo "CCcam_2.x86 is still OK!" >> /var/cccamlog/cccam.check
    fi
    process=`ps auxwww | grep CCcam_3.x86 | grep -v grep | awk '{print $1}'`
    if [ -z "$process" ]; then
    echo "Couldn't find CCcam_3.x86 running.removing nodeid and Restarting CCcam Server" >> /var/cccamlog/cccam.check
    echo && date >> /var/cccamlog/cccam.check
    chown root /tmp/.CCcam.nodeid
    rm /tmp/.CCcam.nodeid && /usr/local/bin/CCcam_3.x86 -C /var/etc/CCcam_3.cfg
    else echo "CCcam_3.x86 is still OK!" >> /var/cccamlog/cccam.check
    fi
    exit


    ################################################## #################################################
    script name MoreCCcamstart.sh
    ################################################## #################################################

    #!/bin/bash
    #Script to start more then one CCcam's with different nodeid
    #Script is written by Youknowhoo.
    echo "Starting first CCcam"
    /emu/cccam/CCcam_1.x86 -C /var/etc/CCcam_1.cfg
    echo "chown owner nodeid"
    chown root /tmp/.CCcam.nodeid
    echo "Removing nodeid and starting second CCcam"
    rm /tmp/.CCcam.nodeid && /emu/cccam/CCcam_2.x86 -C /var/etc/CCcam_2.cfg
    echo "chown owner nodeid"
    chown root /tmp/.CCcam.nodeid
    echo "Removing nodeid and starting third CCcam"
    rm /tmp/.CCcam.nodeid && /emu/cccam/CCcam_3.x86 -C /var/etc/CCcam_3.cfg
    exit



    ################################################## #################################################
    script name MoreCCcamstop
    ################################################## #################################################

    #!/bin/bash
    #Script to stop all CCcam that are running.
    #Script written by Youknowhoo
    echo "stop first CCcam server"
    killall CCcam_1.x86
    echo "stop second CCcam server"
    killall CCcam_2.x86
    echo "stop third CCcam server"
    killall CCcam_3.x86
    exit


    ################################################## #################################################
    script name MoreConfigUpdate.sh
    ################################################## #################################################

    #!/bin/bash
    #Script to process new config and backup old one
    #Script designed and written by CC_Share
    SOURCE=/var/config
    TARGET=/var/etc
    FILE=CCcam_1.cfg
    BACKUPDIR=/var/backup
    CONFIGOLD=CCcam_1.old
    if test -f $SOURCE/$FILE ; then
    echo "New Config Present"
    if test -d $BACKUPDIR ; then
    if test -f $BACKUPDIR/$CONFIGOLD ; then
    echo "Removing OLD config file from backup directory"
    rm $BACKUPDIR/$CONFIGOLD
    else
    echo "No OLD config to remove."
    fi
    if test -f $BACKUPDIR/$FILE ; then
    echo "Renaming Backup to old config"
    cp $BACKUPDIR/$FILE $BACKUPDIR/$CONFIGOLD
    rm $BACKUPDIR/$FILE
    else
    echo "No Backupfile present yet"
    fi
    if test -f $TARGET/$FILE ; then
    echo "Copying Original config to Backup directory"
    cp $TARGET/$FILE $BACKUPDIR
    rm $TARGET/$FILE
    else
    echo "No Original Config File Present!?!?"
    fi
    else
    echo "Backup directory does not exist."
    echo "making new directory"
    mkdir $BACKUPDIR
    if test -f $TARGET/$FILE ; then
    echo "Copying Original config to Backup directory"
    cp $TARGET/$FILE $BACKUPDIR
    else
    echo "No Original Config File Present!?!?"
    fi
    fi
    echo "Moving New config file to "$TARGET
    cp $SOURCE/$FILE $TARGET
    rm $SOURCE/$FILE
    else
    echo "No New Config present, Nothing to process"
    fi
    SOURCE=/var/config
    TARGET=/var/etc
    FILE=CCcam_2.cfg
    BACKUPDIR=/var/backup
    CONFIGOLD=CCcam_2.old
    if test -f $SOURCE/$FILE ; then
    echo "New Config Present"
    if test -d $BACKUPDIR ; then
    if test -f $BACKUPDIR/$CONFIGOLD ; then
    echo "Removing OLD config file from backup directory"
    rm $BACKUPDIR/$CONFIGOLD
    else
    echo "No OLD config to remove."
    fi
    if test -f $BACKUPDIR/$FILE ; then
    echo "Renaming Backup to old config"
    cp $BACKUPDIR/$FILE $BACKUPDIR/$CONFIGOLD
    rm $BACKUPDIR/$FILE
    else
    echo "No Backupfile present yet"
    fi
    if test -f $TARGET/$FILE ; then
    echo "Copying Original config to Backup directory"
    cp $TARGET/$FILE $BACKUPDIR
    rm $TARGET/$FILE
    else
    echo "No Original Config File Present!?!?"
    fi
    else
    echo "Backup directory does not exist."
    echo "making new directory"
    mkdir $BACKUPDIR
    if test -f $TARGET/$FILE ; then
    echo "Copying Original config to Backup directory"
    cp $TARGET/$FILE $BACKUPDIR
    else
    echo "No Original Config File Present!?!?"
    fi
    fi
    echo "Moving New config file to "$TARGET
    cp $SOURCE/$FILE $TARGET
    rm $SOURCE/$FILE
    else
    echo "No New Config present, Nothing to process"
    fi
    SOURCE=/var/config
    TARGET=/var/etc
    FILE=CCcam_3.cfg
    BACKUPDIR=/var/backup
    CONFIGOLD=CCcam_3.old
    if test -f $SOURCE/$FILE ; then
    echo "New Config Present"
    if test -d $BACKUPDIR ; then
    if test -f $BACKUPDIR/$CONFIGOLD ; then
    echo "Removing OLD config file from backup directory"
    rm $BACKUPDIR/$CONFIGOLD
    else
    echo "No OLD config to remove."
    fi
    if test -f $BACKUPDIR/$FILE ; then
    echo "Renaming Backup to old config"
    cp $BACKUPDIR/$FILE $BACKUPDIR/$CONFIGOLD
    rm $BACKUPDIR/$FILE
    else
    echo "No Backupfile present yet"
    fi
    if test -f $TARGET/$FILE ; then
    echo "Copying Original config to Backup directory"
    cp $TARGET/$FILE $BACKUPDIR
    rm $TARGET/$FILE
    else
    echo "No Original Config File Present!?!?"
    fi
    else
    echo "Backup directory does not exist."
    echo "making new directory"
    mkdir $BACKUPDIR
    if test -f $TARGET/$FILE ; then
    echo "Copying Original config to Backup directory"
    cp $TARGET/$FILE $BACKUPDIR
    else
    echo "No Original Config File Present!?!?"
    fi
    fi
    echo "Moving New config file to "$TARGET
    cp $SOURCE/$FILE $TARGET
    rm $SOURCE/$FILE
    else
    echo "No New Config present, Nothing to process"
    fi
    exit



    rc.local:

    /bin/cccam start &
    /emu/script/runonce.sh &
    /var/script/MoreCCcamstart.sh &
    exit 0
    Abraço
    Obelix699

    Cada pessoa assume total responsabilidade e todos os
    riscos advindos do uso de qualquer informação ou ficheiros postados por mim

  2. #2
    Gforum Veterano
    Registo: Oct 2012
    Posts: 1.556

    Padrão

    Mais um grande post amigo.
    Obrigado!

    Continuação de bom trabalho ;)

    Abraço
    Dúvidas? Não enviem PM, criem um tópico :D

    Obrigado...

  3. #3
    Gforum Iniciado
    Registo: Oct 2011
    Idade: 44
    Posts: 19

    Padrão

    Boas amigo vou testar esse script..bom trabalho

  4. #4
    Gforum Dedicado Avatar de LIQUES
    Registo: Sep 2006
    Localização: Torres Vedras
    Idade: 64
    Posts: 469

    Padrão

    Citação Postado originalmente por satneo2 Ver Post
    Boas amigo vou testar esse script..bom trabalho
    E finalmente 10 posts, desde 2011. Boa!!!!!

  5. #5
    Gforum Dedicado Avatar de nansediz
    Registo: Apr 2011
    Posts: 586

    Padrão

    Boas,
    Amigo @obelix699 ou outro amigo qualquer, será que poderiam explicar como meter isto numa VPS?
    Os scripts até entendo, agora o rc.local é que me está a deixar aqui confuso, não vejo o cccam para meter em bin, nem o runonce para meter em emu/script.

    1 abraço nansediz
    Ajudas por MP só a user's ativos no forum

Tópicos Similares

  1. script CCcam 2.1.3/oscam para a Nemesis
    Por nansediz no fórum Duvidas / Ajuda - Dreambox -Linux TV
    Respostas: 0
    Último Post: 02-03-2012, 16:51
  2. Script Mbox/Cccam
    Por Skyplus no fórum Software
    Respostas: 4
    Último Post: 01-10-2010, 12:49
  3. Script Mbox-CCcam para vu+duo
    Por peterg no fórum Dúvidas / Comentários
    Respostas: 1
    Último Post: 08-09-2010, 16:57

Permissões de Postagem

  • Você não pode iniciar novos tópicos
  • Você não pode enviar respostas
  • Você não pode enviar anexos
  • Você não pode editar suas mensagens
  •  

Subscreva a nossa newsletter e habilite-se a ganhar prémios.

* indicates required