You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
300 lines
4.5 KiB
300 lines
4.5 KiB
7 years ago
|
#!/bin/sh
|
||
|
|
||
|
. /etc/init.d/globals
|
||
|
|
||
7 years ago
|
# Camd-Fileflags
|
||
7 years ago
|
FLAGDIR="/var/etc"
|
||
4 years ago
|
|
||
|
F_OPENVPN=".openvpn"
|
||
|
|
||
7 years ago
|
F_DOSCAM=".doscam"
|
||
|
F_OSCAM=".oscam"
|
||
6 years ago
|
F_OSMOD=".osmod"
|
||
7 years ago
|
F_NCAM=".ncam"
|
||
4 years ago
|
F_MGCAMD=".mgcamd"
|
||
6 years ago
|
F_CCCAM=".cccam"
|
||
7 years ago
|
F_GBOX=".gbox"
|
||
|
|
||
4 years ago
|
doscam_action()
|
||
7 years ago
|
{
|
||
|
case $1 in
|
||
|
"start" )
|
||
7 years ago
|
SHOWINFO "start camd_datefix"
|
||
|
/etc/init.d/camd_datefix start doscam
|
||
7 years ago
|
SHOWINFO "start doscam"
|
||
|
/var/bin/doscam -b -w0
|
||
4 years ago
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then
|
||
7 years ago
|
sleep 15
|
||
|
fi
|
||
|
;;
|
||
|
"stop" )
|
||
7 years ago
|
SHOWINFO "stop camd_datefix"
|
||
|
/etc/init.d/camd_datefix stop doscam
|
||
7 years ago
|
SHOWINFO "stop doscam"
|
||
|
killall doscam
|
||
|
sleep 1
|
||
|
rm -rf /tmp/doscam.*
|
||
|
rm -rf /tmp/ecm.info
|
||
|
;;
|
||
|
* )
|
||
4 years ago
|
doscam_action "stop"
|
||
7 years ago
|
sleep 1
|
||
4 years ago
|
doscam_action "start"
|
||
7 years ago
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
4 years ago
|
oscam_action()
|
||
7 years ago
|
{
|
||
|
case $1 in
|
||
|
"start" )
|
||
7 years ago
|
SHOWINFO "start camd_datefix"
|
||
|
/etc/init.d/camd_datefix start oscam
|
||
7 years ago
|
SHOWINFO "start oscam"
|
||
|
/var/bin/oscam -b
|
||
4 years ago
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then
|
||
7 years ago
|
sleep 15
|
||
|
fi
|
||
|
;;
|
||
|
"stop" )
|
||
7 years ago
|
SHOWINFO "stop camd_datefix"
|
||
|
/etc/init.d/camd_datefix stop oscam
|
||
7 years ago
|
SHOWINFO "stop oscam"
|
||
|
killall oscam
|
||
|
sleep 1
|
||
|
rm -rf /tmp/oscam.*
|
||
|
rm -rf /tmp/ecm.info
|
||
|
;;
|
||
|
* )
|
||
4 years ago
|
oscam_action "stop"
|
||
7 years ago
|
sleep 1
|
||
4 years ago
|
oscam_action "start"
|
||
7 years ago
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
4 years ago
|
osmod_action()
|
||
6 years ago
|
{
|
||
|
case $1 in
|
||
|
"start" )
|
||
|
SHOWINFO "start camd_datefix"
|
||
|
/etc/init.d/camd_datefix start osmod
|
||
|
SHOWINFO "start osmod"
|
||
|
/var/bin/osmod -b
|
||
4 years ago
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then
|
||
6 years ago
|
sleep 15
|
||
|
fi
|
||
|
;;
|
||
|
"stop" )
|
||
|
SHOWINFO "stop camd_datefix"
|
||
|
/etc/init.d/camd_datefix stop osmod
|
||
|
SHOWINFO "stop osmod"
|
||
|
killall osmod
|
||
|
sleep 1
|
||
|
rm -rf /tmp/osmod.*
|
||
|
rm -rf /tmp/ecm.info
|
||
|
;;
|
||
|
* )
|
||
4 years ago
|
osmod_action "stop"
|
||
6 years ago
|
sleep 1
|
||
4 years ago
|
osmod_action "start"
|
||
6 years ago
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
4 years ago
|
ncam_action()
|
||
7 years ago
|
{
|
||
|
case $1 in
|
||
|
"start" )
|
||
7 years ago
|
SHOWINFO "start camd_datefix"
|
||
|
/etc/init.d/camd_datefix start ncam
|
||
7 years ago
|
SHOWINFO "start ncam"
|
||
|
/var/bin/ncam -b
|
||
4 years ago
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then
|
||
7 years ago
|
sleep 15
|
||
|
fi
|
||
|
;;
|
||
|
"stop" )
|
||
7 years ago
|
SHOWINFO "stop camd_datefix"
|
||
|
/etc/init.d/camd_datefix stop ncam
|
||
7 years ago
|
SHOWINFO "stop ncam"
|
||
|
killall ncam
|
||
|
sleep 1
|
||
|
rm -rf /tmp/ncam.*
|
||
|
rm -rf /tmp/ecm.info
|
||
|
;;
|
||
|
* )
|
||
4 years ago
|
ncam_action "stop"
|
||
7 years ago
|
sleep 1
|
||
4 years ago
|
ncam_action "start"
|
||
7 years ago
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
4 years ago
|
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()
|
||
7 years ago
|
{
|
||
|
case $1 in
|
||
|
"start" )
|
||
|
SHOWINFO "start cccam"
|
||
|
/var/bin/cccam &
|
||
7 years ago
|
sleep 5
|
||
7 years ago
|
;;
|
||
|
"stop" )
|
||
7 years ago
|
SHOWINFO "stop cccam"
|
||
7 years ago
|
killall cccam
|
||
7 years ago
|
;;
|
||
7 years ago
|
* )
|
||
4 years ago
|
cccam_action "stop"
|
||
7 years ago
|
sleep 1
|
||
4 years ago
|
cccam_action "start"
|
||
7 years ago
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
4 years ago
|
gbox_action()
|
||
7 years ago
|
{
|
||
|
case $1 in
|
||
|
"start" )
|
||
|
SHOWINFO "start gbox"
|
||
|
/var/bin/gbox &
|
||
|
sleep 10
|
||
|
;;
|
||
|
"stop" )
|
||
|
SHOWINFO "stop gbox"
|
||
|
touch /tmp/gbox.kill
|
||
|
sleep 1
|
||
|
rm -rf /tmp/pid.info
|
||
|
rm -rf /tmp/ecm.info
|
||
|
rm -rf /tmp/gbox.pid
|
||
|
rm -rf /tmp/gbox.ver
|
||
|
rm -rf /tmp/gbox.kill
|
||
|
;;
|
||
|
* )
|
||
4 years ago
|
gbox_action "stop"
|
||
7 years ago
|
sleep 1
|
||
4 years ago
|
gbox_action "start"
|
||
7 years ago
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
4 years ago
|
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()
|
||
7 years ago
|
{
|
||
|
case $1 in
|
||
7 years ago
|
"doscam")
|
||
4 years ago
|
doscam_action $ACTION
|
||
7 years ago
|
;;
|
||
|
"oscam")
|
||
4 years ago
|
oscam_action $ACTION
|
||
7 years ago
|
;;
|
||
6 years ago
|
"osmod")
|
||
4 years ago
|
osmod_action $ACTION
|
||
6 years ago
|
;;
|
||
6 years ago
|
"ncam")
|
||
4 years ago
|
ncam_action $ACTION
|
||
|
;;
|
||
|
"mgcamd")
|
||
|
mgcamd_action $ACTION
|
||
6 years ago
|
;;
|
||
7 years ago
|
"cccam")
|
||
4 years ago
|
cccam_action $ACTION
|
||
7 years ago
|
;;
|
||
6 years ago
|
"gbox")
|
||
4 years ago
|
gbox_action $ACTION
|
||
7 years ago
|
;;
|
||
|
*)
|
||
|
if [ -e $FLAGDIR/$F_DOSCAM ]; then
|
||
4 years ago
|
doscam_action $ACTION
|
||
7 years ago
|
fi
|
||
|
|
||
|
if [ -e $FLAGDIR/$F_OSCAM ]; then
|
||
4 years ago
|
oscam_action $ACTION
|
||
7 years ago
|
fi
|
||
|
|
||
6 years ago
|
if [ -e $FLAGDIR/$F_OSMOD ]; then
|
||
4 years ago
|
osmod_action $ACTION
|
||
6 years ago
|
fi
|
||
|
|
||
7 years ago
|
if [ -e $FLAGDIR/$F_NCAM ]; then
|
||
4 years ago
|
ncam_action $ACTION
|
||
|
fi
|
||
|
|
||
|
if [ -e $FLAGDIR/$F_MGCAMD ]; then
|
||
|
mgcamd_action $ACTION
|
||
7 years ago
|
fi
|
||
|
|
||
7 years ago
|
if [ -e $FLAGDIR/$F_CCCAM ]; then
|
||
4 years ago
|
cccam_action $ACTION
|
||
7 years ago
|
fi
|
||
|
|
||
6 years ago
|
if [ -e $FLAGDIR/$F_GBOX ]; then
|
||
4 years ago
|
gbox_action $ACTION
|
||
7 years ago
|
fi
|
||
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
case $1 in
|
||
|
"start")
|
||
|
ACTION="start"
|
||
4 years ago
|
check_openvpn
|
||
|
camd_action $2
|
||
7 years ago
|
;;
|
||
|
"stop")
|
||
|
ACTION="stop"
|
||
4 years ago
|
camd_action $2
|
||
7 years ago
|
;;
|
||
|
*)
|
||
|
ACTION="restart"
|
||
4 years ago
|
camd_action $2
|
||
7 years ago
|
;;
|
||
|
esac
|