Script pour vérifier l'activité du CCcam 2.1.4

santal1

DZSatien Impliqué
Inscrit
26/2/10
Messages
165
Bonjour,

Utilisant depuis qq jours le script pour tester le fonctionnement du CCcam, je me suis apperçu qu'il ne fonctionnait pas bien du tout.
Quand la CAM est Killé parfait mais quand la CAM est toujours en fonctionnement mais plus d'échange cela ne fonctionne plus.

Je propose donc l'amélioration suivante (j'ai codé et testé):

########################## SANTAL1 DZSAT #################################
#!/bin/sh
if pidof $(basename $0) > /dev/null; then
for p in $(pidof $(basename $0)); do
if [ $p -ne $$ ]; then
echo "Script $0 is already running: exiting"
exit
fi
done
fi

Relancer_Cam()
{
echo && date >>/tmp/cccam.check
echo "CCcam Frozen... restarting CCcam" >>/tmp/cccam.check
/usr/script/CCcam_2.1.4_cam.sh stop
sleep 2
/usr/script/CCcam_2.1.4_cam.sh start
}

Lancer_Cam()
{
echo && date >>/tmp/cccam.check
echo "CCcam... restarting" >>/tmp/cccam.check
/usr/script/CCcam_2.1.4_cam.sh start
}

IP="127.0.0.1"
PORT="16000"

# La Dreambox est-elle en phase de mise à jour des droits ? Si oui fin du script; Si non contrôle de l'activité de CCcam 2.1.4
if ps x |grep -v grep |grep -c scam_3.59 >/dev/null
then
exit
else
# La CCcam 2.1.4 est-elle lancé ? Si oui: Contrôle son activité; Si non: on la lance
if ps x |grep -v grep |grep -c CCcam_2.1.4 >/dev/null
then
# La CCcam est-elle planté ? Si oui: vérification de l'accès Internet; Si non: sortie du script
echo info|nc $IP $PORT >>/tmp/cccamtest.txt
if grep "Connected clients:" /tmp/cccamtest.txt | awk '{print $3}'>>/dev/null
then
# Vérification connexion des peers
Connected_Clients=`grep "Connected clients:" /tmp/cccamtest.txt | awk '{print $3}'`
Active_Clients=`grep "Active clients:" /tmp/cccamtest.txt | awk '{print $3}'`
if [ "$Connected_Clients" == "0" ] && [ "$Active_Clients" == "0" ]
then
# La Dreambox est-elle connectée à Internet ? Si oui: Redemarrage de CCcam 2.1.4 ; Si non: Sortie du script
if ping -w 10 -c 1 free.fr | grep ttl >/dev/null
then
Relancer_Cam
fi
fi
else
# La Dreambox est-elle connectée à Internet ? Si oui: arret puis redémarrage de CCcam; Si non: Sortie du script
if ping -w 10 -c 1 free.fr | grep ttl >/dev/null
then
Relancer_Cam
fi
fi
rm /tmp/cccamtest.txt
else
Lancer_Cam
fi
fi
########################## SANTAL1 DZSAT #################################
 
Dernière édition:
Salut; je vois que ton post date de quelques mois mais cela m'intéresse.

Marcherait il sur un serveur ubuntu?

Si oui comment l'utiliser?

L'as tu testé et fonctionne-t-til à merveille?

Merci pour tout
 
+1

comment utiliser et installer ce script

Merci !
 
Retour
Haut