dogfight76
Super Elite User
- Registriert
- 5. Juli 2009
- Beiträge
- 2.569
- Reaktionspunkte
- 242
- Punkte
- 223
#!/bin/sh
# Variablen deklarieren
vCCcam="CCcam2_3_0" # CCcam Version - Script
bCCcam="CCcam2_3_0" # CCcam Version - binary
pCCcam=mein-port # CCcam-WebIf Port
cUser="mein-user" # Username Webinfo
cPass="mein-passwort" # Passwort Webinfo
time=$(date +%A", "%d-%m-%Y" @ "%H:%M:%I)
#echo $time" Script started ..." > /tmp/CCcam_restarts.log
#pruefen ob cccam bin laeuft
if [ "$(ps aux |grep -v grep |grep -c $bCCcam)" == "0" ]
then
BIN=FALSE
echo $time" $vCCcam not running ..." >> /tmp/CCcam_restarts.log
else
BIN=TRUE
echo $time" $vCCcam running ..." >> /tmp/CCcam_restarts.log
fi
#pruefen ob WEB-IF erreichbar
#if wget -q -t2 -O- http://$cUser:$cPass@127.0.0.1:$pCCcam > /dev/null
if wget -q -t2 -O- --user $cUser --password $cPass http://127.0.0.1:$pCCcam > /dev/null
then
WEBIF=TRUE
echo $time" $vCCcam webif running ..." >> /tmp/CCcam_restarts.log
else
WEBIF=FALSE
echo $time" $vCCcam webif not running ..." >> /tmp/CCcam_restarts.log
fi
#wenn WEBIF=FALSE O D E R BIN=FALSE cam neu starten
if [ $BIN == FALSE ]
then
/usr/script/"$vCCcam"_cam.sh start
echo $time" $vCCcam restarted ..." >> /tmp/CCcam_restarts.log
elif [ $WEBIF == FALSE ]
then
/usr/script/"$vCCcam"_cam.sh stop
/usr/script/"$vCCcam"_cam.sh start
echo $time" $vCCcam stopped - restarted ..." >> /tmp/CCcam_restarts.log
else
WEBIF=FALSE
echo $time" $vCCcam is already running ..." >> /tmp/CCcam_restarts.log
fi
exit 0
# Variablen deklarieren
vCCcam="CCcam2_3_0" # CCcam Version - Script
bCCcam="CCcam2_3_0" # CCcam Version - binary
pCCcam=mein-port # CCcam-WebIf Port
cUser="mein-user" # Username Webinfo
cPass="mein-passwort" # Passwort Webinfo
time=$(date +%A", "%d-%m-%Y" @ "%H:%M:%I)
#echo $time" Script started ..." > /tmp/CCcam_restarts.log
#pruefen ob cccam bin laeuft
if [ "$(ps aux |grep -v grep |grep -c $bCCcam)" == "0" ]
then
BIN=FALSE
echo $time" $vCCcam not running ..." >> /tmp/CCcam_restarts.log
else
BIN=TRUE
echo $time" $vCCcam running ..." >> /tmp/CCcam_restarts.log
fi
#pruefen ob WEB-IF erreichbar
#if wget -q -t2 -O- http://$cUser:$cPass@127.0.0.1:$pCCcam > /dev/null
if wget -q -t2 -O- --user $cUser --password $cPass http://127.0.0.1:$pCCcam > /dev/null
then
WEBIF=TRUE
echo $time" $vCCcam webif running ..." >> /tmp/CCcam_restarts.log
else
WEBIF=FALSE
echo $time" $vCCcam webif not running ..." >> /tmp/CCcam_restarts.log
fi
#wenn WEBIF=FALSE O D E R BIN=FALSE cam neu starten
if [ $BIN == FALSE ]
then
/usr/script/"$vCCcam"_cam.sh start
echo $time" $vCCcam restarted ..." >> /tmp/CCcam_restarts.log
elif [ $WEBIF == FALSE ]
then
/usr/script/"$vCCcam"_cam.sh stop
/usr/script/"$vCCcam"_cam.sh start
echo $time" $vCCcam stopped - restarted ..." >> /tmp/CCcam_restarts.log
else
WEBIF=FALSE
echo $time" $vCCcam is already running ..." >> /tmp/CCcam_restarts.log
fi
exit 0
In meiner Duo2 heisst unter "usr/bin" die CCcam genauso "CCcam2_3_0"
WebIf "User" ,"Passwort" und "Port" wurden verfälscht, aber kontrolliert (ist erreichbar)
Das Script heißt so:
"CCcam2_3_0_cam.sh"
im Cronjob ist der Interval so gesetzt:
Auszuführender Befehl: /usr/script/CCcam2_3_0_cam.sh
Minute: */15
Minute: */15
So sollte alle 15min das Script ausgeführt werden oder ?
Findet ihr einen Fehler ?
Gruß