|
|
@ -4,43 +4,18 @@ |
|
|
|
|
|
|
|
# Camd-Fileflags |
|
|
|
FLAGDIR="/var/etc" |
|
|
|
F_MGCAM=".mgcamd" |
|
|
|
|
|
|
|
F_OPENVPN=".openvpn" |
|
|
|
|
|
|
|
F_DOSCAM=".doscam" |
|
|
|
F_OSCAM=".oscam" |
|
|
|
F_OSMOD=".osmod" |
|
|
|
F_NCAM=".ncam" |
|
|
|
F_MGCAMD=".mgcamd" |
|
|
|
F_CCCAM=".cccam" |
|
|
|
F_GBOX=".gbox" |
|
|
|
|
|
|
|
MGCAM_Action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"start" ) |
|
|
|
SHOWINFO "start mgcamd" |
|
|
|
{ /var/bin/mgcamd; pzapit -rz; } & |
|
|
|
;; |
|
|
|
"stop" ) |
|
|
|
SHOWINFO "stop mgcamd" |
|
|
|
kill $( cat /tmp/mgcamd.pid ) |
|
|
|
sleep 1 |
|
|
|
rm -rf /tmp/mgstat.info |
|
|
|
rm -rf /tmp/mgshare.info |
|
|
|
rm -rf /tmp/ecm.info |
|
|
|
rm -rf /tmp/pid.info |
|
|
|
rm -rf /tmp/ca_cache.list |
|
|
|
rm -rf /tmp/cccam.info |
|
|
|
rm -rf /tmp/ecm.info |
|
|
|
rm -rf /tmp/mg.info |
|
|
|
;; |
|
|
|
* ) |
|
|
|
MGCAM_Action "stop" |
|
|
|
sleep 1 |
|
|
|
MGCAM_Action "start" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
|
DOSCAM_Action() |
|
|
|
doscam_action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"start" ) |
|
|
@ -48,7 +23,7 @@ DOSCAM_Action() |
|
|
|
/etc/init.d/camd_datefix start doscam |
|
|
|
SHOWINFO "start doscam" |
|
|
|
/var/bin/doscam -b -w0 |
|
|
|
if [ -e $FLAGDIR/$F_MGCAM ]; then |
|
|
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then |
|
|
|
sleep 15 |
|
|
|
fi |
|
|
|
;; |
|
|
@ -62,14 +37,14 @@ DOSCAM_Action() |
|
|
|
rm -rf /tmp/ecm.info |
|
|
|
;; |
|
|
|
* ) |
|
|
|
DOSCAM_Action "stop" |
|
|
|
doscam_action "stop" |
|
|
|
sleep 1 |
|
|
|
DOSCAM_Action "start" |
|
|
|
doscam_action "start" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
|
OSCAM_Action() |
|
|
|
oscam_action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"start" ) |
|
|
@ -77,7 +52,7 @@ OSCAM_Action() |
|
|
|
/etc/init.d/camd_datefix start oscam |
|
|
|
SHOWINFO "start oscam" |
|
|
|
/var/bin/oscam -b |
|
|
|
if [ -e $FLAGDIR/$F_MGCAM ]; then |
|
|
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then |
|
|
|
sleep 15 |
|
|
|
fi |
|
|
|
;; |
|
|
@ -91,14 +66,14 @@ OSCAM_Action() |
|
|
|
rm -rf /tmp/ecm.info |
|
|
|
;; |
|
|
|
* ) |
|
|
|
OSCAM_Action "stop" |
|
|
|
oscam_action "stop" |
|
|
|
sleep 1 |
|
|
|
OSCAM_Action "start" |
|
|
|
oscam_action "start" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
|
OSMOD_Action() |
|
|
|
osmod_action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"start" ) |
|
|
@ -106,7 +81,7 @@ OSMOD_Action() |
|
|
|
/etc/init.d/camd_datefix start osmod |
|
|
|
SHOWINFO "start osmod" |
|
|
|
/var/bin/osmod -b |
|
|
|
if [ -e $FLAGDIR/$F_MGCAM ]; then |
|
|
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then |
|
|
|
sleep 15 |
|
|
|
fi |
|
|
|
;; |
|
|
@ -120,14 +95,14 @@ OSMOD_Action() |
|
|
|
rm -rf /tmp/ecm.info |
|
|
|
;; |
|
|
|
* ) |
|
|
|
OSMOD_Action "stop" |
|
|
|
osmod_action "stop" |
|
|
|
sleep 1 |
|
|
|
OSMOD_Action "start" |
|
|
|
osmod_action "start" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
|
NCAM_Action() |
|
|
|
ncam_action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"start" ) |
|
|
@ -135,7 +110,7 @@ NCAM_Action() |
|
|
|
/etc/init.d/camd_datefix start ncam |
|
|
|
SHOWINFO "start ncam" |
|
|
|
/var/bin/ncam -b |
|
|
|
if [ -e $FLAGDIR/$F_MGCAM ]; then |
|
|
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then |
|
|
|
sleep 15 |
|
|
|
fi |
|
|
|
;; |
|
|
@ -149,14 +124,42 @@ NCAM_Action() |
|
|
|
rm -rf /tmp/ecm.info |
|
|
|
;; |
|
|
|
* ) |
|
|
|
NCAM_Action "stop" |
|
|
|
ncam_action "stop" |
|
|
|
sleep 1 |
|
|
|
NCAM_Action "start" |
|
|
|
ncam_action "start" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
|
CCCAM_Action() |
|
|
|
mgcamd_action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"start" ) |
|
|
|
SHOWINFO "start mgcamd" |
|
|
|
{ /var/bin/mgcamd; pzapit -rz; } & |
|
|
|
;; |
|
|
|
"stop" ) |
|
|
|
SHOWINFO "stop mgcamd" |
|
|
|
kill $( cat /tmp/mgcamd.pid ) |
|
|
|
sleep 1 |
|
|
|
rm -rf /tmp/mgstat.info |
|
|
|
rm -rf /tmp/mgshare.info |
|
|
|
rm -rf /tmp/ecm.info |
|
|
|
rm -rf /tmp/pid.info |
|
|
|
rm -rf /tmp/ca_cache.list |
|
|
|
rm -rf /tmp/cccam.info |
|
|
|
rm -rf /tmp/ecm.info |
|
|
|
rm -rf /tmp/mg.info |
|
|
|
;; |
|
|
|
* ) |
|
|
|
mgcamd_action "stop" |
|
|
|
sleep 1 |
|
|
|
mgcamd_action "start" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
|
cccam_action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"start" ) |
|
|
@ -169,14 +172,14 @@ CCCAM_Action() |
|
|
|
killall cccam |
|
|
|
;; |
|
|
|
* ) |
|
|
|
CCCAM_Action "stop" |
|
|
|
cccam_action "stop" |
|
|
|
sleep 1 |
|
|
|
CCCAM_Action "start" |
|
|
|
cccam_action "start" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
|
GBOX_Action() |
|
|
|
gbox_action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"start" ) |
|
|
@ -195,64 +198,85 @@ GBOX_Action() |
|
|
|
rm -rf /tmp/gbox.kill |
|
|
|
;; |
|
|
|
* ) |
|
|
|
GBOX_Action "stop" |
|
|
|
gbox_action "stop" |
|
|
|
sleep 1 |
|
|
|
GBOX_Action "start" |
|
|
|
gbox_action "start" |
|
|
|
;; |
|
|
|
esac |
|
|
|
} |
|
|
|
|
|
|
|
CAMD_Action() |
|
|
|
check_openvpn() |
|
|
|
{ |
|
|
|
if [ -e $FLAGDIR/$F_OPENVPN ]; then |
|
|
|
# wait i seconds for openvpn |
|
|
|
i=10 |
|
|
|
while [ $i -gt 0 ]; do |
|
|
|
if pidof openvpn > /dev/null; then |
|
|
|
SHOWINFO "openvpn is started" |
|
|
|
i=-1 # leave loop |
|
|
|
else |
|
|
|
SHOWINFO "wait for openvpn ... $i" |
|
|
|
sleep 1 |
|
|
|
fi |
|
|
|
i=$(($i-1)) |
|
|
|
if [ $i = 0 ]; then |
|
|
|
SHOWINFO "continue without openvpn" |
|
|
|
fi |
|
|
|
done |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
camd_action() |
|
|
|
{ |
|
|
|
case $1 in |
|
|
|
"mgcamd") |
|
|
|
MGCAM_Action $ACTION |
|
|
|
;; |
|
|
|
"doscam") |
|
|
|
DOSCAM_Action $ACTION |
|
|
|
doscam_action $ACTION |
|
|
|
;; |
|
|
|
"oscam") |
|
|
|
OSCAM_Action $ACTION |
|
|
|
oscam_action $ACTION |
|
|
|
;; |
|
|
|
"osmod") |
|
|
|
OSMOD_Action $ACTION |
|
|
|
osmod_action $ACTION |
|
|
|
;; |
|
|
|
"ncam") |
|
|
|
NCAM_Action $ACTION |
|
|
|
ncam_action $ACTION |
|
|
|
;; |
|
|
|
"mgcamd") |
|
|
|
mgcamd_action $ACTION |
|
|
|
;; |
|
|
|
"cccam") |
|
|
|
CCCAM_Action $ACTION |
|
|
|
cccam_action $ACTION |
|
|
|
;; |
|
|
|
"gbox") |
|
|
|
GBOX_Action $ACTION |
|
|
|
gbox_action $ACTION |
|
|
|
;; |
|
|
|
*) |
|
|
|
if [ -e $FLAGDIR/$F_MGCAM ]; then |
|
|
|
MGCAM_Action $ACTION |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -e $FLAGDIR/$F_DOSCAM ]; then |
|
|
|
DOSCAM_Action $ACTION |
|
|
|
doscam_action $ACTION |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -e $FLAGDIR/$F_OSCAM ]; then |
|
|
|
OSCAM_Action $ACTION |
|
|
|
oscam_action $ACTION |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -e $FLAGDIR/$F_OSMOD ]; then |
|
|
|
OSMOD_Action $ACTION |
|
|
|
osmod_action $ACTION |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -e $FLAGDIR/$F_NCAM ]; then |
|
|
|
NCAM_Action $ACTION |
|
|
|
ncam_action $ACTION |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then |
|
|
|
mgcamd_action $ACTION |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -e $FLAGDIR/$F_CCCAM ]; then |
|
|
|
CCCAM_Action $ACTION |
|
|
|
cccam_action $ACTION |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -e $FLAGDIR/$F_GBOX ]; then |
|
|
|
GBOX_Action $ACTION |
|
|
|
gbox_action $ACTION |
|
|
|
fi |
|
|
|
;; |
|
|
|
esac |
|
|
@ -261,14 +285,15 @@ CAMD_Action() |
|
|
|
case $1 in |
|
|
|
"start") |
|
|
|
ACTION="start" |
|
|
|
CAMD_Action $2 |
|
|
|
check_openvpn |
|
|
|
camd_action $2 |
|
|
|
;; |
|
|
|
"stop") |
|
|
|
ACTION="stop" |
|
|
|
CAMD_Action $2 |
|
|
|
camd_action $2 |
|
|
|
;; |
|
|
|
*) |
|
|
|
ACTION="restart" |
|
|
|
CAMD_Action $2 |
|
|
|
camd_action $2 |
|
|
|
;; |
|
|
|
esac |
|
|
|