Jump to content


Photo

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


  • Please log in to reply
19 replies to this topic

#1 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 23 March 2012 - 18:27

first problem:
install services by my own script which works on all other images

root@dm800se:~# /usr/script/MartiniChannelsListE2_download_userscript.sh
head: invalid option -- '1'
BusyBox v1.18.5 (2012-03-10 02:19:32 CET) multi-call binary.
Usage: head [OPTIONS] [FILE]...
Print first 10 lines of each FILE (or stdin) to stdout.
With more than one FILE, precede each with a filename header.
Options:
-n N[kbm] Print first N lines
N may be suffixed by k (x1024), b (x512), or m (x1024^2).
Connecting to www.kjhdssjoi.tv (1.8.3.5:80)
extract files from servicesE2_bc.tar.gz
reaload services and bouquets
root@dm800se:~#

whats wrong with script
#!/bin/sh
# MartiniB #
## configuration
URL="[url="http://www.fyulwdkfjds.tt/m/LNBs/"]http://www.fyulwdkfjds.tt/m/LNBs/[/url]"
FILENAME="servicesE2_bc.tar.gz"
## end
foo="$0"
shTXT=${foo%.*}".txt"
shFORCE=`echo $0| sed s?download?download\(forced\)?`
[ -e "$shFORCE" ] && rm -f ""$shFORCE""
shFORCE=`echo $0| sed s?download?download_FORCED?`
[ ! -e "$shFORCE" ] && echo "#!/bin/sh
rm -f "$shTXT"
"$0"">"$shFORCE" && chmod 755 "$shFORCE"
RemoveTerrestialBouquets () {
sed -e 's/.*"userbouquet\.lattelecom\.tv".*//' -e 's/.*"userbouquet\.baltkom\.tv".*//' /etc/enigma2/bouquets.tv| sed '/^$/d'>/etc/enigma2/bouquets.tv.tmp
[ -s /etc/enigma2/bouquets.tv.tmp ] && mv /etc/enigma2/bouquets.tv.tmp /etc/enigma2/bouquets.tv
rm -f /etc/enigma2/*lattelecom.tv /etc/enigma2/*baltkom.tv
}
DirEnigma=/etc/enigma2/
E2conf="$DirEnigma"settings
rm -rf /tmp/$FILENAME /tmp/"$FILENAME"_md5.txt
wget -q "$URL$FILENAME"_md5.txt -P /tmp
if [ "$?" = "0" ]; then
  if [ -s /tmp/"$FILENAME"_md5.txt ]; then
CrntMD5=`cat -u /tmp/"$FILENAME"_md5.txt| head -1`
if [ -e "$shTXT" ]; then
  PrevMD5=`cat -u "$shTXT"| head -1`
else
  PrevMD5="00"
fi
if [ "$PrevMD5" = "$CrntMD5" ]; then
  echo "file on server isn't changed"
else
   wget $URL$FILENAME -P /tmp
   if [ "$?" = "0" ]; then
	 if [ -s /tmp/$FILENAME ]; then
  echo extract files from "$FILENAME"
  echo "$CrntMD5">"$shTXT"
  rm -f "$DirEnigma"userbouquet.*
  tar -zxf /tmp/$FILENAME -C /
  #[ ! `grep -qs "Type: DVB-T" /proc/bus/nim_sockets` ] && RemoveTerrestialBouquets
  [ `grep -ics "DVB-T" /proc/bus/nim_sockets` -eq 0 ] && RemoveTerrestialBouquets
  if grep -qs ".sat.3590." "$E2conf"|| grep -qs ".sat.50." "$E2conf"|| grep -qs ".sat.158." "$E2conf"; then
   echo change sat positions in Enigma2 config
   echo restart GUI && sleep 2
   init 4
   sed -e 's/\.sat\.3590\./\.sat\.3592\./' -e 's/\.sat\.50\./\.sat\.48\./' -e 's/\.sat\.158\./\.sat\.160\./' "$E2conf">"$E2conf".tmp
   mv "$E2conf".tmp "$E2conf"
   init 3
  else
   echo reaload services and bouquets
   #wget -O /dev/null -q [url="http://127.0.0.1/web/servicelistreload?mode=0"]http://127.0.0.1/web/servicelistreload?mode=0[/url]
   killall -9 enigma2
  fi
	 else
  echo Zero len /tmp/$FILENAME
	 fi
   else
  echo !!! Download $URL$FILENAME failed !!!
   fi
fi
  else
  echo Zero len /tmp/"$FILENAME"_md5.txt
  fi
else
  echo !!! Download "$URL$FILENAME"_md5.txt failed !!!
fi
exit 0


start own emu as second problem:
copyed my own starting script into /usr/script>oscam_cam.sh
and made simlink to
ln -s /usr/script/oscam_cam.sh /etc/init.d/softcam-oscam-ymod
but in emu list new emu didnt came ....
:(
is there only real files posible as /etc/init.d/softcam-**** ?

Re: why first steps on OpenPLI image harder than on any other image #2 Erik Slagter

  • PLi® Core member
  • 46,969 posts

+542
Excellent

Posted 23 March 2012 - 18:52

root@dm800se:~# /usr/script/MartiniChannelsListE2_download_userscript.sh
head: invalid option -- '1'
BusyBox v1.18.5 (2012-03-10 02:19:32 CET) multi-call binary.
Usage: head [OPTIONS] [FILE]...
Print first 10 lines of each FILE (or stdin) to stdout.
With more than one FILE, precede each with a filename header.
Options:
-n N[kbm] Print first N lines
N may be suffixed by k (x1024), b (x512), or m (x1024^2).

Exactly what is says ;) Usage of head -1 etc. is deprecated.

* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: why first steps on OpenPLI image harder than on any other image #3 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 23 March 2012 - 19:26

but why new BusyBox has that limitations?
on other(today's experimental Newnigma2) it is older and dont have such problem

root@Dream8k_M4:~# busybox
BusyBox v1.15.3 (2011-09-16 09:25:37 UTC) multi-call binary
....
..



Re: why first steps on OpenPLI image harder than on any other image #4 littlesat

  • PLi® Core member
  • 57,176 posts

+698
Excellent

Posted 23 March 2012 - 19:35

emu's should be start/stop with a script in /etc/init.d... named softcam.nameOfScript.... when the script is in the proper format (with start, stop, restart options) the softcam manager from PLi does the rest.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: why first steps on OpenPLI image harder than on any other image #5 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 23 March 2012 - 19:50

then `head` is broken or what
OpenPLI
[email="root@dm800se"]root@dm800se[/email]:~# echo `echo -e 'ddddddddddddd\ntttttttttt'`
ddddddddddddd tttttttttt
[email="root@dm800se"]root@dm800se[/email]:~# echo `echo -e 'ddddddddddddd\ntttttttttt'| head -1`
head: invalid option -- '1'
BusyBox v1.18.5 (2012-03-10 02:19:32 CET) multi-call binary.
Usage: head [OPTIONS] [FILE]...
Print first 10 lines of each FILE (or stdin) to stdout.
With more than one FILE, precede each with a filename header.
Options:
	    -n N[kbm]	   Print first N lines
N may be suffixed by k (x1024), b (x512), or m (x1024^2).

[email="root@dm800se"]root@dm800se[/email]:~#

Newnigma2
[email="oot@Dream8k_M4"]oot@Dream8k_M4[/email]:~#
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~# echo `echo -e 'ddddddddddddd\ntttttttttt'`		
ddddddddddddd tttttttttt
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~#
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~# echo `echo -e 'ddddddddddddd\ntttttttttt'| head -1`
ddddddddddddd
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~#
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~# head -h
head: invalid option -- 'h'
BusyBox v1.15.3 (2011-09-16 09:25:37 UTC) multi-call binary
Usage: head [OPTIONS] [FILE]...
Print first 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the
file name. With no FILE, or when FILE is -, read standard input.
Options:
	    -n NUM  Print first NUM lines instead of first 10
	    -c NUM  Output the first NUM bytes
	    -q	  Never output headers giving file names
	    -v	  Always output headers giving file names
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~#


emu starting script altredy have {start|stop|restart}
will try as real file

Re: why first steps on OpenPLI image harder than on any other image #6 WanWizard

  • PLi® Core member
  • 70,534 posts

+1,811
Excellent

Posted 23 March 2012 - 19:53

We use a much newer busybox then the other image. Our image is not broken, the other ones are old junk. ;)

Look up the word deprecated.

Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Ultimate (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: why first steps on OpenPLI image harder than on any other image #7 theparasol

  • Senior Member
  • 4,157 posts

+198
Excellent

Posted 23 March 2012 - 19:54

dont forget to chmod 755 the softcam.xxxx file ;)

@Camping: ZGemma H.2S, Technisat Multytenne 4-in-1 @Home: Edision Mini 4K, Wave Frontier T55, EMP Centauri EMP DiSEqC 8/1 switch, 4x Inverto Ultra Black single LNB


Re: why first steps on OpenPLI image harder than on any other image #8 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 23 March 2012 - 19:57

please example, english isnt my native

Re: why first steps on OpenPLI image harder than on any other image #9 littlesat

  • PLi® Core member
  • 57,176 posts

+698
Excellent

Posted 23 March 2012 - 20:09

head -1 is not correct... it should be most likely head -n1!!! Why the other image exepts head -1 without the n or PLi does not except it, is for me a ??? At least in PLi's busybox the n is a required thing....

root@et9x00:/etc/enigma2# head lamedb -n1
eDVB services /4/
root@et9x00:/etc/enigma2# head lamedb -1
head: invalid option -- '1'
BusyBox v1.18.5 (2012-03-11 02:00:50 CET) multi-call binary.
Usage: head [OPTIONS] [FILE]...
Print first 10 lines of each FILE (or stdin) to stdout.
With more than one FILE, precede each with a filename header.
Options:
-n N[kbm] Print first N lines
N may be suffixed by k (x1024), b (x512), or m (x1024^2).
root@et9x00:/etc/enigma2#

Edited by littlesat, 23 March 2012 - 20:13.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: why first steps on OpenPLI image harder than on any other image #10 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 23 March 2012 - 20:17

Thanks!!!
maibe cause scripts are made couple years ago
and most reason is my limited skills, usualy examples are took from google
in case -n1 compatible with old BusyBox i have no problem change in every script

Re: why first steps on OpenPLI image harder than on any other image #11 littlesat

  • PLi® Core member
  • 57,176 posts

+698
Excellent

Posted 23 March 2012 - 21:25

-n1 should work always... -1 not ;)

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: why first steps on OpenPLI image harder than on any other image #12 Erik Slagter

  • PLi® Core member
  • 46,969 posts

+542
Excellent

Posted 23 March 2012 - 21:53

Option -1 has been deprecated for years, I think for more then ten years.

Please look up a word if you don't understand it, MartiniB!

Edited by Erik Slagter, 23 March 2012 - 21:53.

* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.


Re: why first steps on OpenPLI image harder than on any other image #13 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 23 March 2012 - 22:51

move forward is ok, but who can be happy when some thing which worked couple years stops work

one of problem why my emu starter script doesnt work is command `ls` cant show full path where goes link to
ok with Newnigma2(old):
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~#
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~# ls -l /etc/rc3.d/S98emustart
lrwxrwxrwx    1 root	 root		   25 Mar 23 06:30 /etc/rc3.d/S98emustart -> /usr/script/oscam_cam.emu
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~#
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~# echo `ls -l /etc/rc3.d/S98emustart| sed s/.*\ //`
/usr/script/oscam_cam.emu
[email="root@Dream8k_M4"]root@Dream8k_M4[/email]:~#

nok with OpenPLI:
[email="root@dm800se"]root@dm800se[/email]:~# ls -l /etc/rc2.d/S50softcam
lrwxrwxrwx    1 root	 root		    17 Mar 22 22:35 /etc/rc2.d/S50softcam -> ../init.d/softcam
[email="root@dm800se"]root@dm800se[/email]:~# ls -l /etc/init.d/softcam
lrwxrwxrwx    1 root	 root		    19 Mar 23 23:10 /etc/init.d/softcam -> softcam.oscamYmodT2
[email="root@dm800se"]root@dm800se[/email]:~#
[email="root@dm800se"]root@dm800se[/email]:~# echo `ls -l /etc/rc2.d/S50softcam| sed s/.*\ //`
../init.d/softcam
[email="root@dm800se"]root@dm800se[/email]:~#


Re: why first steps on OpenPLI image harder than on any other image #14 mirakels

  • Forum Moderator
    PLi® Core member
  • 7,603 posts

+62
Good

Posted 23 March 2012 - 23:58

If you come here to learn about Linux/Unix you better start finding a good site about Linux/Unix. (we used to have a topic about it in one of the off-topic forums).
But your ls -l example works just fine. Openpli does the same as newenigma2. We just have different link structures.
If newenigma would have multiple levels of softlinks you would see the same thing. This is just how linux works. It has nothing to do with OpenPli itself.

(the same holds for your busybox issue. We tend to use more up to date versions of the all tools in openpli. That may cause different behaviour compared to others. But hey, if I would take my 20 year old tv I still would have its features that I may like, but it won't let me view HD channels. :)
Geen wonder... Had slechts een dm7000, maar wel ook een rotor. eigenlijk al een tijdje ook een dm600 en dm7025. Maar nu kijkend met een et9000 en vuduo

Re: why first steps on OpenPLI image harder than on any other image #15 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 24 March 2012 - 06:20

@Mirakels
thanks for answer,
im more than 10 years in linux receivers world - years with D-Box1(Nokia 9500) -> one year dm500 -> years with dm7020 -> half year dm800 -> years with dm8k
most of my scripts started grove at E1 times and still compatible

and please mai you show example how read where link goes to

p.s.
First problem solved sucessfully, thanks to all and spetial to Littlesat

p.s.2
why forum engine changes content in [code=auto:0] section?

Re: why first steps on OpenPLI image harder than on any other image #16 mirakels

  • Forum Moderator
    PLi® Core member
  • 7,603 posts

+62
Good

Posted 24 March 2012 - 09:12

being round in the unix/linux world for 20 years I've changed many of my script/tools to adapt to changed features because of OS upgrades or moving from one unix implementation to the other. All the D-Box and dmxxx boxes used basically the same versions of all software since the started these projects. Openpli wants to go forward and tries to be at the edge (sort of what the fedora project is doing :) We don't want to look back, but move forward!

So if you go openpli prepare for checking your script regularly for using 'old' or 'deprecated' constructs or for changes made in the filesystem hierarchy.
Things like 'head' and 'ls' are obvious linux commands and basically have nothing to do with openpli itself (unless you can see commits like 'change head to force using the -n option'.) Google is a better friend for many issues like the ones you mention above. I'm sure you find lots of good pages on how to find the real filename of a symbolic link. I do not know a simple one from the top of my head....
Geen wonder... Had slechts een dm7000, maar wel ook een rotor. eigenlijk al een tijdje ook een dm600 en dm7025. Maar nu kijkend met een et9000 en vuduo

Re: why first steps on OpenPLI image harder than on any other image #17 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 24 March 2012 - 12:06

nice to see someone else not only me dont know everything about everything

ok, moving forward
in case dirrect link to real starter script werent posible have made
/etc/init.d>softcam.oscam-ymod which starts my script
#!/bin/sh
echo `date +%Y.%m.%d.\ %H:%M:%S`" $0 $1">>/tmp/emu_start_stop.log
ShFILE=/usr/script/oscam_cam.sh
case "$1" in
*st*)
  #$ShFILE $1>/dev/null &
  $ShFILE $1 &
  sleep 1
;;
restart|reload)
  $0 stop
  sleep 1
  $0 start
;;
version)
  echo `grep ^CAMNAME= $ShFILE| sed s/CAMNAME=//| sed s/\"//g`
;;
info)
  #echo "oscam-ymod"
  echo ${0##*.}
;;
*)
  echo "Usage: $0 start|stop|restart|version|info"
  exit 1
;;
esac
exit 0
this method works then
but there problems cant stop :)
when call scritp from telnet then it works but when from menu then didnt
there sample of script
#!/bin/sh
echo "0 $0">>/tmp/120323
echo "1 "`echo "$0"| sed -e s#/##`>>/tmp/120323
dirname "2 $0">>/tmp/120323
tt01="$0"
echo "3 "`echo $tt01| sed -e s#/##`>>/tmp/120323
echo "4 "`dirname "$0"| sed -e s#/##`>>/tmp/120323
tt02=${tt01##/}
echo "5 $tt02">>/tmp/120323
echo "6 ${tt02%%/*}">>/tmp/120323
StartDIR=${0##/} StartDIR=${StartDIR%%/*}
echo "7 $StartDIR">>/tmp/120323
and that is result when call from telnet:

0 /usr/script/oscam_cam.sh
1 usr/script/oscam_cam.sh
2 /usr/script
3 usr/script/oscam_cam.sh
4 usr/script
5 usr/script/oscam_cam.sh
6 usr
7 usr

and there result when call from menu

0 /usr/script/oscam_cam.sh
1
2 /usr/script
3
4
5 usr/script/oscam_cam.sh
6 usr
7 usr

particular problem i have solved by change
from:
StartDIR="/"`echo $0| sed -e s#/## -e s#/.*## -e s#etc#usr#`"/"
to:
StartDIR=${0##/}
StartDIR=${StartDIR%%/*}
[ ! "$StartDIR" ] && echo aborting, startdir of $0 not found && exit || StartDIR="/"$StartDIR"/"

but i can gues i will have problems in other scripts cause that difference between started from console and started from menu

Re: why first steps on OpenPLI image harder than on any other image #18 Dimitrij

  • PLi® Core member
  • 10,328 posts

+350
Excellent

Posted 24 March 2012 - 13:12


#!/bin/sh

case "$1" in

start)

	    /usr/bin/oscam -b -c /etc/tuxbox/config & 2>/dev/null	  

;;

stop)

	    killall -9 oscam 2>/dev/null

		 rm -rf /tmp/*.info  2>/dev/null

	  

;;

restart|reload)

$0 stop

sleep 2

$0 start

;;

version)

echo "Ymod"

;;

info)

echo "Oscam Ymod"

;;

*)

echo "Usage: $0 start|stop|restart"

exit 1

;;

esac

exit 0


GigaBlue UHD Quad 4K /Lunix3-4K/Duo 4K


Re: why first steps on OpenPLI image harder than on any other image #19 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 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 :(

Re: why first steps on OpenPLI image harder than on any other image #20 MartiniB

  • Senior Member
  • 49 posts

0
Neutral

Posted 26 March 2012 - 07:30

any comment why script started from GUI(CI / emu section) gives different result than started from telnet console?
i about http://openpli.org/f...post__p__265754

similar problem i have had with DMM experimental images in period ~2011.jun till ~2012.jan
http://www.dream-mul...2520#post102520
problem is gone, fixed by DMM, i didnt catch when and how

Edited by MartiniB, 26 March 2012 - 07:30.



2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users