Jump to content


MartiniB

Member Since 11 Apr 2007
Offline Last Active 27 Dec 2017 18:30
-----

#266621 Device Volume control by Alsa Mixer (Dreambox DM8000)

Posted by MartiniB on 27 March 2012 - 18:31

houpe you will find a way how extend volume contoll amplitude
DMM can't:
http://www.dream-mul...81153#post81153


#265781 why first steps on OpenPLI image harder than on any other image

Posted by MartiniB on 24 March 2012 - 13:51

thanks Dima, but i cant say your script does anything what i need
start subproceses like files updater and server side
-does health checking-
doesnt kill process if it alredy present and script started with just start option not restart
makes symbolic link with different name to able run one oscam binary once as oscam.emu(client) and other instances of oscam_1 as servers
search newest version in /???/bin/
compatible with GP.E1/E2; NN2; DE;
......
..

/usr/script/oscam_cam.sh
#!/bin/sh
# MartiniB #
#
 
#
# kill copyes of self
#
foo="$0"
crntNameExt=${foo##*/}
PID_FILE=/var/run/"$crntNameExt".pid
[ -f "$PID_FILE" ] && kill `cat $PID_FILE`>/dev/null
echo $$>"$PID_FILE"
#lnOF="oscam1.00.svn4298.mips_tuxbox._"
#lnOF="oscam.svn*"
#lnOF="oscam.ymod.v17*"
#lnOF="oscam.ymod.v18*"
lnOF="oscam"
CAMNAME="OSCAM.ymod.v18t27"
USERNAME="OSCAM.ymod.v18t27"
ZAPTIME=3
CAMID=0700
DVBSET=3
START_TIME=3
STOPP_TIME=2
INFOFILE="ecm.info"
INFOFILELINES=
CAMD_ID=700
CAMD_NAME="OSCAM.ymod.v18t27"
CAMD_BIN="oscam.emu"
INFOFILE_A="ecm0.info"
INFOFILE_B="ecm1.info"
INFOFILE_C="ecm2.info"
INFOFILE_D="ecm3.info"
#Expert window
INFOFILE_LINES=1111111111000000
#Zapp after start
REZAPP=0
BINNAME2="oscam.emuSVN"
BINNAME="oscam.emu"
#BINNAME2=""
#StartDIR="/"`echo $0| sed -e s#/## -e s#/.*## -e s#etc#usr#`"/"
StartDIR=${0##/}
StartDIR=${StartDIR%%/*}
#echo `echo "$0"| sed -e s#/##`>>/tmp/120324
echo `date`" $0 $1 - $StartDIR">>/tmp/120324
[ ! "$StartDIR" ] && echo aborting, startdir of $0 not found && exit || StartDIR="/"$StartDIR"/"
BinPATH=$StartDIR"bin/"
ShPATH=$StartDIR"script/"
KeysPATH=$StartDIR"keys/"
STARTBEFORE1=$ShPATH"oscam_startbefore.sh"
STARTBEFORE2=$ShPATH"oscam_startbefore2.sh"
STARTBEFORE3=$ShPATH"oscam_startbefore3.sh"
STARTBEFORE4=$ShPATH"oscam_startbefore4.sh"
STARTBEFORE5=$ShPATH"oscam_startbefore5.sh"
AUTOUPDATE=1
ShUPDATE="oscam_update.sh"
FILESUPDATE="$ShPATH$ShUPDATE"
#end
PROCESSa="$BINNAME"
PROCESSz="$BINNAME2"
# restart when count of instances lower or equal
#
[ -e /etc/init.d/softcam ] && CryticalLowInstancesCount=1|| CryticalLowInstancesCount=4
#DebugMODE="-d128"
#DebugMODE="-d130"
#DebugMODE="-d255"
OPTIONS=" -c $KeysPATH$PROCESSa -t /tmp/$PROCESSa -r2 $DebugMODE"
[ -e "$2" ] && OPTIONS2=" $2"
if [ ! "$lnOF" = "" ]; then
lnOF=`ls $BinPATH$lnOF| tail -1`
if [ ! "$lnOF" = "" ] && [ ! "$lnOF" = "$BinPATH$PROCESSa" ]; then
  ln -sf $lnOF $BinPATH$PROCESSa
fi
fi
kill_self () {
PID_FILE2=/var/run/`echo "$crntNameExt"| sed s?_cam.sh?_update.sh?`.pid
[ -e "$PID_FILE2" ] && kill `cat $PID_FILE2`>/dev/null && rm -rf "$PID_FILE2"
pids=`pidof $PROCESSa $PROCESSz`
[ -n "$pids" ] && kill -9 $pids>/dev/null
sleep 2
}
start_STARTBEFORE () {
  for i in "$STARTBEFORE1" "$STARTBEFORE2" "$STARTBEFORE3" "$STARTBEFORE4" "$STARTBEFORE5"; do
if [ -e "$i" ]; then
  iFileName=${i##*/}
  CountOfPids=`ps| grep -v grep| grep -c "/$iFileName "`
  if [ $CountOfPids = 0 ]; then
	chmod 755 "$i"
   "$i" start &
   sleep 3
  fi
fi
  done
}
start_if_not_found () {
  start_STARTBEFORE
  echo `date +%Y.%m.%d.\ %H:%M:%S`>`echo "$0"| sed s?_cam.sh?_cam?`.started
  while true
  do
CountOfPids=`ps| grep -v grep| grep -c "/$PROCESSa "`
echo `date +%Y/%m/%d\ %H:%M:%S`" $crntNameExt -> CountOf $PROCESSa Pids: $CountOfPids"
if [ $CountOfPids = 0 ]; then
  chmod 755 $BinPATH$PROCESSa
  $BinPATH$PROCESSa $OPTIONS$OPTIONS2 &
  [ ! -L /tmp/"$INFOFILE_A" ] && ln -s /tmp/"$INFOFILE" /tmp/"$INFOFILE_A" &
  sleep 10
  [ "$AUTOUPDATE" = "1" ] && [ -e "$FILESUPDATE" ] && "$FILESUPDATE" &
  sleep 10
elif [ "$CountOfPids" -le "$CryticalLowInstancesCount" -o "$CountOfPids" -ge 100 ]; then
  kill_self
else
  start_STARTBEFORE
  sleep 30
fi
  done
}
[ -L "$STARTBEFORE1" ] && STARTBEFORE1=`ls -l "$STARTBEFORE1"| sed s/.*\ //`
[ -L "$STARTBEFORE2" ] && STARTBEFORE2=`ls -l "$STARTBEFORE2"| sed s/.*\ //`
[ -L "$STARTBEFORE3" ] && STARTBEFORE3=`ls -l "$STARTBEFORE3"| sed s/.*\ //`
[ -L "$STARTBEFORE4" ] && STARTBEFORE4=`ls -l "$STARTBEFORE4"| sed s/.*\ //`
[ -L "$STARTBEFORE5" ] && STARTBEFORE5=`ls -l "$STARTBEFORE5"| sed s/.*\ //`
for i in "$STARTBEFORE1" "$STARTBEFORE2" "$STARTBEFORE3" "$STARTBEFORE4" "$STARTBEFORE5" "$FILESUPDATE"; do
[ -e "$i" ] && chmod 755 "$i"
done
echo `date +%Y.%m.%d.\ %H:%M:%S`" $0 $1">>/tmp/emu_start_stop.log
case "$1" in
  start)
rm -rf "$PID_FILE"
$0 start+ &
  ;;
  start+)
echo "[SCRIPT] $1: $CAMNAME"
start_if_not_found
  ;;
  restart|restart0)
echo "[SCRIPT] $1: $CAMNAME"
kill_self
start_if_not_found
  ;;
  stop|stopall|restartall)
if [ "$1" = "stopall" -o "$1" = "restartall" ]; then
   [ -e "$STARTBEFORE1" ] && "$STARTBEFORE1" stop &
   [ -e "$STARTBEFORE2" ] && "$STARTBEFORE2" stop &
   [ -e "$STARTBEFORE3" ] && "$STARTBEFORE3" stop &
   [ -e "$STARTBEFORE4" ] && "$STARTBEFORE4" stop &
   [ -e "$STARTBEFORE5" ] && "$STARTBEFORE5" stop &
fi
echo "[SCRIPT] $1: $CAMNAME"
kill_self
rm -rf "$PID_FILE"
[ "$1" = "restartall" ] && "$0" start+ &
  ;;
  *)
rm -rf "$PID_FILE"
$0 stop &
sleep 2
exit 1
  ;;
esac
exit 0

now i have problems with option `-does health checking-`
i were use count of instances cause usualy oscam doesnt crash all and disaper from proceses list
in other E1/E2 systems count of oscam instances usualy are ~4-10 and when goes less i can gues there is only web-if alive
but in OpenPLI just only two instances can be counted, no mater web-if enabled or how many readers :(