1. Diese Seite verwendet Cookies. Wenn du dich weiterhin auf dieser Seite aufhältst, akzeptierst du unseren Einsatz von Cookies. Weitere Informationen

hilfe bitte bei cccam+oscam ckeck.

Dieses Thema im Forum "OScam Archiv" wurde erstellt von koko99, 23. Februar 2011.

  1. koko99
    Offline

    koko99 Ist gelegentlich hier

    Registriert:
    26. April 2009
    Beiträge:
    74
    Zustimmungen:
    3
    Punkte für Erfolge:
    8
    habe dream 7000 mit gemmini + cccam und oscam am laufen.
    bräuchte ein script das wen cccam+oscam hängen bleibt wieder automatisch startet.
    Wer kann mir bitte helfen (wen ich nur cccam laufen Habe funkt das script was ich Habe . nur cccam+ oscam geht nicht)
     
    #1
  2. phantom

    Nervigen User Advertisement

  3. feissmaik
    Offline

    feissmaik Elite User

    Registriert:
    21. November 2010
    Beiträge:
    1.666
    Zustimmungen:
    513
    Punkte für Erfolge:
    0
    Ort:
    FarFarAway
    AW: hilfe bitte bei cccam+oscam ckeck.

    Wie sieht denn dein Script aus?


    Warscheinlich ist es auch nur für CCcam... So ohne weiteres kann man es nicht auch noch für OScam nutzen... Nicht ohne modifikationen

    OScam zu prüfen ob es noch reagiert ist leider recht schwierig via Script - bei CCcam ist es dahingegen einfach

    cccam:
    Code:
    #!/bin/sh
    #
    # 08.2010 by meigrafd
    #
    ## Changelog:
    #
    # v0.50  added editor mode for config files (it uses nano if installed else vi)
    #        added support for rar -> if installed backuplogs gets packed with -m5
    #        readded old and still supported cmds...
    #        added /var/log/kern.log (or any other?) to get backuped on crash
    #        fixed script-config-checks...
    #        fixed connection failed handling of nc...
    #        optimized code...
    #
    # v0.44: added $CCcamLOG as CCcam-output-log filename
    #        added another script-config-checks...
    #
    # v0.43: added BACKUPCARDCHECK to make backups of logfiles on crash
    #        removed RESPONDCHECK coz DETECTCHECK does the same (but its still useable)
    #
    # v0.42: added check for "detected and working cards" 
    #        added /tmp/CCcamCheck.lock file so the script cant run twice
    #
    # v0.41: added '-i 1' to respond/detected checks as NCINTERVAL
    #        changed script syntax for cronjob to: check auto
    #        added misc stuff like script-config-checks etc...
    #
    # v0.40: added RESPONDCHECK
    #        added ENABLECOLORS
    #        fixed start_cam
    #
    #
    ## Recommended HowTo:
    #
    #
    # ! ->  ITS VERY IMPORTEND THAT YOU   D O N T   FORWARD ANY OTHER PORTS
    # ! ->  EXCEPT CCCAM-SERVER-LISTEN-PORT OUTSIDE YOUR LAN !!
    # ! ->  YOU SHOULD ALSO CHANGE   A L L   DEFAULT PORTS !!
    #
    #
    # Add a new shell user and install there your CCcam:
    #
    #  useradd -m -s/bin/bash CS
    #  usermod -G CS,dialout CS
    #  su - CS
    #  mkdir CCcam ; mkdir CCcam/bin ; mkdir CCcam/logs ; mkdir CCcam/etc
    #
    # Copy your files as followed: (inc. this script as: cccam)
    #
    #  CCcam/
    #  cccam
    #
    #  CCcam/etc:
    #  CCcam.cfg  CCcam.channelinfo  CCcam.providers  SoftCam.Key  AutoRoll.Key  constant.cw
    #
    #  CCcam/bin:
    #  CCcam.211.x86
    #
    # Change the following in your CCcam.cfg:
    #
    #  TELNETINFO USERNAME : 
    #  TELNETINFO PASSWORD : 
    #  TELNETINFO LISTEN PORT : 16000
    #  SOFTKEY FILE : /home/CS/CCcam/etc/SoftCam.Key
    #  AUTOROLL FILE : /home/CS/CCcam/etc/AutoRoll.Key
    #  STATIC CW FILE : /home/CS/CCcam/etc/constant.cw
    #  CAID PRIO FILE : /home/CS/CCcam/etc/CCcam.prio
    #  PROVIDERINFO FILE : /home/CS/CCcam/etc/CCcam.providers
    #  CHANNELINFO FILE : /home/CS/CCcam/etc/CCcam.channelinfo
    #  LOG WARNINGS : /home/CS/CCcam/logs/warnings.log
    #
    # Add some cronjob entry so CCcam gets started on reboot and gets checked every 2 minutes:
    #
    #  echo "@reboot	$HOME/CCcam/cccam start  >/dev/null 2>&1" >> $HOME/.cron
    #  echo "*/2 * * * *	$HOME/CCcam/cccam check auto >/dev/null 2>&1" >> $HOME/.cron
    #  crontab $HOME/.cron
    #
    # NOTE: i recommend to use */2 !
    #       */2 means every 2 minutes (eg.: 12:00, 12:02, 12:04, 12:06, 12:08, 12:10, 12:12...)
    #       set it only to * means every minute
    #
    # ...Feel free to change the paths...
    # ...which depends on your receiver/image/system...
    #
    #
    ### CONFIG - START
    
    
    # Enable "detected and working cards"-check ? [yes/no]
    DETECTCHECK="yes"
    
    # For Card-Detected-Check, what is the FIRST word of your card? [Betacrypt/Viaccess/Nds]
    # (currently only one identical cardname supported!)
    CARDNAME="Betacrypt"
    
    # How many cards your using with this CCcam?
    CARDNUM="2"
    
    # CCCam-IP of your CCcam-Server for respond-checks (normaly: localhost/127.0.0.1)
    # NOTE: you need to set this for DETECTCHECK
    CCCAMIP="127.0.0.1"
    
    # TELNETINFO-LISTEN-PORT of your CCcam-Server for respond-checks [CCcam-default: 16000]
    # NOTE: you need to set this for DETECTCHECK
    TELNETPORT="16000"
    
    # Create backups from logs of above card-check if it failed ? [yes/no]
    # Files get packed with tar as .tgz (.tar.gz)
    BACKUPCARDCHECK="yes"
    
    # Should we backup also another system-log-file for debugging?
    # setting this to "" works too or add more files seperated by space
    BACKUPSYSLOGFILELIST="/var/log/kern.log"
    
    # Enable colored output-lines on shell? [yes/no]
    ENABLECOLORS="yes"
    
    # Path where the CCcam binary lies, no trailing / [CCcam-default: /var/emu]
    CCcamPATH="/home/CS/CCcam/bin"
    
    # Name of the CCcam binary [CCcam-default: cccam]
    # NOTE: if you want to run more than one CCcam-server:
    # rename the binary (eg: CCcam.2.x86) , make a copy of this cccam-script and reconfigure it...
    CCcamBIN="CCcam.211.x86"
    
    # Path to save the CCcam logs to, no trailing / [CCcam-default: /tmp]
    CCcamPLOG="/home/CS/CCcam/logs"
    
    # Inside $CCcamPLOG the CCcam-output-log is saved to which file?
    CCcamLOG="log.CCcam"
    
    # Inside $CCcamPLOG we save the crontabed checks to which file?
    CCcamCLOG="check.CCcam.log"
    
    # Complete /path/to/file of your CCcam.cfg [CCcam-default: /var/etc/CCcam.cfg]
    CCcamCFG="/home/CS/CCcam/etc/CCcam.cfg"
    
    # Options to start CCcam with [CCcam-default: <none>]
    # NOTE: DON'T edit unless you know what you are doing!
    # NOTE: you MUST set at last "-C /path/to/CCcam.cfg" if its NOT CCcam-default!
    # NOTE: im using -d to save CCcam's output into a logfile which gets deleted every re/start!
    CCcamOPTIONS="-t -d -C $CCcamCFG"
    
    # delay interval for lines sent (for responding check) [default: <empty>]
    # NOTE: DON'T edit unless you know what you are doing!
    # NOTE: if your CCcam-server runs on an 1xChip dbox its possible that the
    # respond-check tooks too long for this script. Than you need to set
    # this to '-i 3' or '-i 4'... it waits longer befor quitting and fail...
    NCINTERVAL="-i 2"
    
    
    # default System's binary paths to locate nano and rar, no trailing /
    # NOTE: DON'T edit unless you know what you are doing!
    SYSTEMbinPATHS="/bin /usr/bin"
    
    
    
    ### CONFIG - END
    
    
    
    # -------------------------------------------------------------- #
    # >>> >> >  DO NOT MESS WiTH ANYTHiNG BELOW THiS LiNE!  < << <<< #
    # -------------------------------------------------------------- #
    
    
    
    
    
    DATE=`date`
    CHECKFILE="/tmp/cccamtest.log"
    tmpCARDNUM="0"
    unset CHECKED
    if [ "$SYSTEMbinPATHS" = "" ]; then
    	SYSTEMbinPATHS="/bin /usr/bin"
    fi
    
    if [ "$ENABLECOLORS" = "yes" ]; then
    		ROT=`tput setaf 1`
    		GRUEN=`tput setaf 2`
    		BOLD=`tput bold`
    		NORM='tput op && tput sgr0'
    	else
    		ROT="" ; GRUEN="" ; BOLD="" ; NORM=""
    fi
    
    
    if [ ! -z "$USECONFiG" ]; then
    	## Read script-config
    	if [ -z $scriptconfig ]; then
    		scriptconfig="`dirname $0`/Checkcccam.conf"
    	fi
    	if [ ! -r $scriptconfig ]; then
    		echo $ROT "ERROR: Can not read $scriptconfig"; $NORM
    		exit 0
    	else
      	. $scriptconfig
    	fi
    fi
    
    
    # This methode deletes old and creates an new logfile for CCcam on re/start
    create_new_log() {
    	if [ ! -e $CCcamPLOG/$CCcamLOG ]; then
    		touch $CCcamPLOG/$CCcamLOG
    	else
    		rm -f $CCcamPLOG/$CCcamLOG
    		touch $CCcamPLOG/$CCcamLOG
    	fi
    }
    
    # This method starts CCcam
    start_cam() {
    	  if ps x |grep -v grep |grep -c $CCcamBIN >/dev/null
    		then
    			echo $ROT "ERROR: $CCcamBIN still runs with pid: $(pidof $CCcamBIN)" ; $NORM
    		else
    			create_new_log
    			cd $CCcamPATH
    			./$CCcamBIN $CCcamOPTIONS > $CCcamPLOG/$CCcamLOG 2>&1 &
    			#./$CCcamBIN $CCcamOPTIONS &
    			echo $GRUEN "Successfully started CCcam with pid: $(pidof $CCcamBIN)" ; $NORM
    		fi
    }
    		
    # This method stops CCcam
    stop_cam() {
    		PiD=$(pidof $CCcamBIN)
    		if [ -z "$PiD" ]; then
    			echo $ROT "ERROR: Cant see $CCcamBIN to stop..." ; $NORM
    		else
    			echo $GRUEN "Stopping CCcam with pid: $PiD" ; $NORM
    			kill -9 $PiD
    		fi
    }
    
    # This method checks for running process, detected and working cards and restarts if not...
    check_run() {
    		if ps x |grep -v grep |grep -c $CCcamBIN >/dev/null
    		then
    			echo $GRUEN "Seems CCcam still runs with pid: $(pidof $CCcamBIN)" ; $NORM
    			if [ "$DETECTCHECK" = "yes" ]; then
    					sleep 1 ; check_cards
    			fi
    		else
    			echo "["$DATE"] BAD - Couldn't see $CCcamBIN running. Starting!" >> $CCcamPLOG/$CCcamCLOG
    			echo $ROT "Couldn't see $CCcamBIN running. Starting!" ; $NORM
    			start_cam
    		fi
    }
    
    # This method checks detected and working cards and restarts if not...
    check_cards() {
    		echo "...Checking if all CCcam '$CARDNAME' cards are presend"
    		echo entitlements|nc $NCINTERVAL $CCCAMIP $TELNETPORT > $CHECKFILE
    		if [ "$?" != "0" ]; then
    			echo $ROT "ERROR while connecting to CCcam Server!" ; $NORM
    			echo "["$DATE"] BAD - ERROR while connecting to CCcam Server!" >> $CCcamCLOG
    			proc_exit
    		fi
    		CardDetect=$(grep -w $CARDNAME $CHECKFILE)
    		tmpCARDNUM=$(grep -c $CARDNAME $CHECKFILE)
    		if [ "$tmpCARDNUM" = "$CARDNUM" ]; then
    			echo $GRUEN " OK - $tmpCARDNUM Cards are shown in entitlements!"; $NORM
    			echo "$CardDetect"
    		else
    			echo "["$DATE"] BAD - Only $tmpCARDNUM/$CARDNUM Cards detected! Restarting CCcam: $CCcamBIN" >> $CCcamCLOG
    			echo $ROT " BAD - Only $tmpCARDNUM/$CARDNUM Cards detected! Restarting CCcam: $CCcamBIN"; $NORM
    			if [ "$BACKUPCARDCHECK" = "yes" ]; then
    				echo " Creating backup from logs: $CCcamPLOG/$CBFILE"
    				echo "["$DATE"] Created backup from logs: $CCcamPLOG/$CBFILE" >> $CCcamCLOG
    				$PACKAGER $CHECKFILE $CCcamPLOG/$CCcamLOG $BACKUPSYSLOGFILELIST > $CCcamPLOG/$CBFILE
    				sleep 1
    			fi
    			stop_cam
    			sleep 10
    			start_cam
    		fi
    		rm -f $CHECKFILE
    }
    
    # This method checks if CCcam still responding like it should
    check_respond() {
    		process=`ps auxwww | grep $CCcamBIN | grep -v grep | awk '{print $1}'`
    		if [ -z "$process" ]; then
    			echo $ROT " BAD - Couldn't find $CCcamBIN running. Restarting!"; $NORM
    			echo "["$DATE"] BAD - Couldn't find $CCcamBIN running. Restarting!" >> $CCcamPLOG/$CCcamCLOG
    			start_cam
    		else
    			echo $GRUEN "CCcam process is present, now checking if CCcam is frozen"; $NORM
    			# minimize Logfile size
    			LASTLINECHECK=`tail -n1 $CCcamPLOG/$CCcamCLOG | grep "now checking if CCcam is frozen"`
    			if [ -z "$LASTLINECHECK" ]; then
    				echo "CCcam process is present, now checking if CCcam is frozen" >> $CCcamPLOG/$CCcamCLOG
    			fi
    			echo info|nc $NCINTERVAL $CCCAMIP $TELNETPORT > $CHECKFILE
    			if [ "$?" != "0" ]; then
    				echo $ROT "ERROR while connecting to CCcam Server!" ; $NORM
    				echo "["$DATE"] BAD - ERROR while connecting to CCcam Server!" >> $CCcamPLOG/$CCcamCLOG
    				rm -f $CHECKFILE ; proc_exit
    			fi
    			CHECKED=$(ls -s $CHECKFILE)
    			if [ "$CHECKED" = "0" ]; then
    				echo $ROT " BAD - CCcam is frozen, restarting CCcam: $CCcamBIN"; $NORM
    				echo "["$DATE"] BAD - CCcam is frozen, restarting CCcam" >> $CCcamPLOG/$CCcamCLOG
    				stop_cam
    				sleep 10
    				start_cam
    			else
    				echo $GRUEN " OK - CCcam is responding like it should!"; $NORM
    				# FixMe: output responding to shell if its NOT triggered: check auto
    				if [ ! "$2" = "auto" ]; then
    						echo "CCcam responding:"
    						echo $(cat $CHECKFILE)
    				fi
    				# minimize Logfile size
    				LASTLINECHECK=`tail -n1 $CCcamPLOG/$CCcamCLOG | grep "CCcam is responding like it should"`
    				if [ -z "$LASTLINECHECK" ]; then
    					echo "["$DATE"] OK - CCcam is responding like it should" >> $CCcamPLOG/$CCcamCLOG
    				fi
    			fi
    			rm -f $CHECKFILE
    		fi
    }
    
    proc_Get_Packager() {
    	unset PACKAGER
    	CBFNOW=$(date +"%d.%m.%Y_%H%M")
    	for Spath in $SYSTEMbinPATHS ; do
    				if [ -x $Spath/rar ]; then
    						PACKAGER="$Spath/rar a -inul -tk -m5 -y"
    						CBFILE="backup_checklog__$CBFNOW.rar"
    					fi
    	done
    	if [ -z "$PACKAGER" ]; then
    			PACKAGER="tar -cz"
    			CBFILE="backup_checklog__$CBFNOW.tgz"
    	fi
    }
    
    proc_Get_Editor() {
    	unset UseEDITOR
    	for Spath in $SYSTEMbinPATHS ; do
    		if [ -x "$Spath/nano" ]; then
    			UseEDITOR="$Spath/nano -R"
    		fi
    	done
    	if [ -z "$UseEDITOR" ]; then
    		for Spath in $SYSTEMbinPATHS ; do
    			if [ -x "$Spath/vi" ]; then
    				UseEDITOR="$Spath/vi"
    			fi
    		done
    	fi
    	if [ -z "$UseEDITOR" ]; then
    		echo $ROT "ERROR: Unable to locate Editor to open file - Be sure SYSTEMbinPATHS is set currectly!" ; $NORM
    		proc_exit
    	fi
    }
    
    # edit files given from $1
    edit_file() {
    	case "$1" in
    		conf*)
    			EFILE="$CCcamCFG"
    			if test -f $EFILE ; then
    				echo "Opening file: $EFILE ... with: $UseEDITOR"
    				sleep 1 ; $UseEDITOR $EFILE
    			else
    				echo -e "\033[1;31mError opening file: $EFILE !\033[0m"
    			fi
    		;;
    		*)
    			echo "err... $*"
    		;;
    	esac
    }
    
    
    proc_Find_CCcamBIN() {
    	CCCAMbinLIST=""
    	if [ ! -z "$CCcamPATH" ]; then
    			CPfilelist=$(ls $CCcamPATH)
    			for Cfile in $CPfilelist ; do
    				if [ "$Cfile" = "[cC][cC][cC][aA][mM]*" ]; then
    					CCCAMbinLIST="$CCCAMbinLIST $Cfile"
    				fi
    			done
    	fi
    }
    
    
    proc_exit() {
    	rm -f "/tmp/CCcamCheck.lock"
    	exit 0
    }
    
    if [ -e "/tmp/CCcamCheck.lock" ]; then
    	if [ "`find \"/tmp/CCcamCheck.lock\" -type f -mmin -5`" ]; then
    			echo "Lockfile /tmp/CCcamCheck.lock exists and is not 5 minutes old yet. Quitting!"
    			exit 0
    	else
    			echo "Lockfile exists, but its older then 5 minutes. Removing lockfile."
    			touch "/tmp/CCcamCheck.lock"
    	fi
    else
    	touch "/tmp/CCcamCheck.lock"
    fi
    
    
    ## script-config checks...
    if [ ! -d "$CCcamPLOG" ]; then
    	echo $ROT "ERROR: Directory $CCcamPLOG does not exist - Check paths and permissions!" ; $NORM
    	proc_exit
    fi
    
    if [ ! -w "$CCcamPLOG/$CCcamCLOG" ]; then
    	echo $ROT "ERROR: Can not write to $CCcamPLOG/$CCcamCLOG - Check paths and perms!" ; $NORM
    	proc_exit
    fi
    
    if [ ! -e $CCcamPATH/$CCcamBIN ]; then
    	echo $ROT "ERROR: Can not find CCcam binary: $CCcamPATH/$CCcamBIN - Check paths and perms!" ; $NORM
    	proc_exit
    fi
    
    if [ ! -e $CCcamPLOG/$CCcamCLOG ]; then               
    	touch $CCcamPLOG/$CCcamCLOG
    fi
    
    
    # read configs  ((c) SEG74)
    proc_Get_CCcamcfg() {
      CCUSER=$(grep -i "WEBINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
      CCPASS=$(grep -i "WEBINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
      CCPORT=$(grep -i "WEBINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
      CCTPORT=$(grep -i "TELNETINFO LISTEN PORT" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')      
      CCTUSER=$(grep -i "TELNETINFO USERNAME" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
      CCTPASS=$(grep -i "TELNETINFO PASSWORD" $CCcamCFG | cut -d ":" -f2 | sed -e 's/ //g' | sed -e 's/\r//g')
      #echo "CCUSER: $CCUSER"; echo "CCPASS: $CCPASS"; echo "CCPORT: $CCPORT"
      #echo "CCTUSER: $CCTUSER"; echo "CCTPASS: $CCTPASS"; echo "CCTPORT: $CCTPORT"           
    }
    proc_Get_CCcamcfg
    
    if [ "$DETECTCHECK" = "yes" -a "$TELNETPORT" != "" -a "$CCTPORT" != "" ]; then
    	if [ ! "$TELNETPORT" = "$CCTPORT" ]; then
    		echo $ROT "ERROR: Your script-config isnt the same as your CCcam configuration!"
    		echo "Your script setting: $TELNETPORT ... But in your CCcam.cfg is TELNETINFO-port: $CCTPORT"; $NORM
    		proc_exit
    	fi
    	proc_Get_Packager
    fi
    
    
    case "$1" in
    	start)
    		echo "[SCRIPT] $1:"
    		start_cam
    	;;
    	stop)
    		echo "[SCRIPT] $1:"
    		stop_cam
    	;;
    	restart)
    		echo "[SCRIPT] $1:"
    		stop_cam
    		sleep 10
    		start_cam
    	;;
    	check)
    		echo "[SCRIPT] $1:"
    		check_run
    	;;
    	card*)
    		echo "[SCRIPT] $1:"
    		check_cards
    	;;
    	respond*)
    		echo "[SCRIPT] $1:"
    		check_respond
    	;;
    	conf*)
    		echo "[SCRIPT] $1:"
    		proc_Get_Editor
    		edit_file $1
    	;;
    	*)
    		echo "Usage: $0 [start|stop|restart|check|cards|respond|conf]"
    	;;
    esac
    proc_exit
    Code:
    #!/bin/sh
    #
    # For users without crond (eg.: receivers)
    #  upload this script to your receiver, set chmod 755     
    #  and add this script into /etc/rc.local eg.: /bin/crond     
    #
    ### CONFIG - START
    
    
    ## Full "/path/to/script and command" to get executed?
    EXEC="/home/CCcam/cccam check"
    
    ## Run the Script very ... seconds
    ## NOTE: DONT set this below 30sec!
    EVERY="120"
    
    
    ### CONFIG - END
    
    
    while [ 1 ]; do
            $EXEC
            sleep $EVERY
    done
    
    exit 0
    


    Dieser Link ist nur für Mitglieder!!! Jetzt kostenlos Registrieren ?

     
    #2
    xaxa11 gefällt das.
  4. koko99
    Offline

    koko99 Ist gelegentlich hier

    Registriert:
    26. April 2009
    Beiträge:
    74
    Zustimmungen:
    3
    Punkte für Erfolge:
    8
    AW: hilfe bitte bei cccam+oscam ckeck.

    das läuft bei cccam perfekt was muß ich noch einfügen das es mit cccam+oscam 0.99.4 auch geht

    #!/bin/sh
    if ps x |grep -v grep |grep -c CCcam >/dev/null
    then
    echo "cccam... ok"
    else
    echo "cccam... restarting"
    /var/bin/CCcam_2.0.11 &
    fi
     
    #3

Diese Seite empfehlen