About a half year after my last announcement on Dreambox monitoring my sitestemata I can announce new and probably one of the last versions of Nuki. Версията беше готова още преди 2 months of laziness but where where things are for debugging with pozabaviha announcement. From a few days working on 32 dreambox 500-s, and the results are very good. The changes are very – removed is the idiotic according to the Linux server to transfer logs – Now you need to have apache + php, because the new system for writing logs is to submit parameters to a php script on the server. I changed the script to work without the server part – If you have some satellite receivers is not meaningful to you put a server from which to take the info so I can move the script hardkodnato with 2 variable information for CAM-. I have also declared an additional variable to debug – If you do not want your not throwing logs – again retarded gap than previously 🙂 Light popraviki in the code were made, It looked like as written by polugramoten retard (not that I'm not de). Ostrane us 2 critical errors leading to the termination of the work of the script at some random moment, again oligofrenski omissions on my part. Generally the writing wasn't very simply had to consider to do as people, that busybox and ash are not easy things to domestication. This time I think to save big rant with the code and to explain what variables for what it is and what treatments may be made with her (new) 🙂

SERVER="192.168.100.1"
 STANDALONE="FALSE" #using like stand alone app no server side depends ; )
 HCAM1="" ## if starting like stand alone app give me CAM namezzz if HCAM1 is empty its means chanel is free
 HCAM2="" ## CAM2 name
 PORT="666" # port rockzzz : D : )))))))))))))))))
 IP=$(ifconfig eth0 | grep inet | awk '{print $2}' | sed -e '[email protected]:@@')
 FILE='/tmp/debug'
 INFO='/tmp/info_file'
 NC=$(which nc)
 WGET=$(which wget)
 MAX_DAYS="10"
 TIMEOUT="600"
 MAX=70 #max cpu usage per process
DEBUGING="TRUE" #if u wanna script send debug information set DEBUGING to TRUE if SEVERLESS is set to true this var will be skiped
 NEWDBGSTYLE="TRUE" #debuging new style sending info to apache derectly, old style using nc

So obviously promenliviti names speak for themselves but enough though and I mean some clever word.

STANDALONE is one of the most important variable is TRUE if the setnata is not going to make calls to the server and won't require anymore according to the server if you use it you have to put the following values and HCAM1 (I don't know why I named it like that I don't remember now but no matter). If there is no real value in it and is a standalone script skritpa assuming will work on unencrypted channels and there is no verification for decryption module, If there will test according to the specified real value. HCAM2 optional if you only use the decoder module 1 Let's say for example process CCcam.

DEBUGING the second interesting variable prlûe or information you will keep silent according to depends on what value you are slammed. Avotmatično passes in a cut if STANDALONE is TRUE

NEWDBGSTYLE draft an important variable. It will transfer the logs to the server. If TRUE will is the new way without idiostkata according to netcat. If you still keep the old method put FALSE. In General, these are the things I need to focus but I think, Although the changes are radical an idea will remain transparent for the specified default values 🙂

Definitely I'm very pleased with how you work out – the script became sufficiently flexible otpdnaha idiotkite according to additional files for features as well as otpdna already and I think according to the nc or the need for a server, etc. not everyone enjoys 30+ box-a that a server or you may have a router a. Still has a lot to improve but for now I think I'm going to abstain from things because takvia is not necessary 🙂

As files are usually located in Directory а крипта за въвеждане на логовете може да свалите от here

And in case a good script a piece for an accelerated all accelerators 😀

Enhanced by Zemanta

From almost a year I was working on my demočeto NUKA. Today I have time to fix things because there were a lot of things that were not very well. I added a bit of new functionality. I rearranged the code, with more features and shorted it became more user friendly.

The main new feature that I put a signal trap-. At some point as you rotate the demon dreambox receiver decides to kill him and thus stop monitoring my process, which in itself is quite an unpleasant moment. And there's no way to figure out what is going on because the place is a bit of dirt and logs must do make complex patterns of network shares that you do not want to deal. In general lines signal trap-is a pleasant feature of bash scripts to intercept signals from the outputs or those submitted to them by the kernel through a kill-say 😉 and thus we can prevent some of the immediately subsequent events. Damn that SIGKIL or kill -9 cannot be prehvanat and prevented, that's the core design. It terminated directly submitted his PID. And now the error code

#trapping signals I know -9 dosent work but we try it just in case ; )
trap on_exit 0 14 1 2 9 13 15 6 8 4 3 11 5
on_exit () {
make_debug 10 #unexpected error
#reboot now if we hawe trapped signal
reboot -d 0
exit 0
}

The first line declares the US as to the action to be taken and in which alerts will we read more about alerts man signals in the case of these 😉 me care. As you can see result in a simple funkciika that makes debugging applications message and restart the receiver. I'm not convinced, that will lead to the outcome that I expect, because I think that everything that hinders is killing with kill -9 but nothing prevents to try.

Other changes are the cardinal features most things that are repeated by the code fill them in functions, It was a bit unsightly not, now that is good, I had a 😉 de drama with a return in bash- – I put on my return in one function and expected behavior as all other familiar programming languages, but it turned out that only return integer values and returns it to a maximum of 2 😀 and I wanted to return the string. There was an ugly pig. The solution is simple

#---cuted---

if [ $T -eq $N ]
 then
 echo "Cam is down! Reboot..."
make_debug 4 # cam is down
 else
echo $rcam
 fi

# ---cuted----

#finding real cam1
 rcam1=$(find_cam $cam1)

Първата част е края на функцията ми и чрез echo изплювам резултата. Взимането му е елементарно с последния ред в горния пасаж.

Hmmm I think, that's the interesting part of the code.

I want to express my gratitude to the inspiration 😉

http://www.youtube.com/watch?v=SilMJ0O13UI&feature=related

most- Finally I was able to finish work on the script I write so much time already 🙂 NUKA it is one quite stable script. emphasize 1 because removing the extra script I built it in the main. It has gained a monolithic structure, but personally I think it is better for a demon version 🙂 Already improvements are not very, rather are fixes on some tiny bugs and attempts to improve code. The only tangible thing I have added a check for uptime-and Receiver. Set it up for everyone 10 days to make himself restart.

Looking back, my initial idea for a script that simply monitor receivers what sluchava them think, that I realized happily good idea many times. The only bug that I hope to avoid a 10 daily reboot is – there are moments in which the receiver begins to restart, but fails. Killing most workshops including network but neuspyava reach restart. Unfortunately due to the limitations imposed by my boxes nemozhyah to do is restart the kernel and thus escaped and now. Maybe some day in the future will compile my image for its boxes and thus able to deal with this problem. For now nadyavma last my decision to gloss over 🙂 Otherwise everything else extremely well received, even much better than my original idea. Especially since, Rename it in such metamorphoses. Most part remained buggy web interfeisa, therefore continue not to give 😆 once sat to rewrite these days will get him for free consumption. final words – instead of procrastinating just I want to thank all my friends, that endured my stupid questions about this and that – You have an important contribution in deizaina code. Deserves appreciation and man who is named my project and served as inspiration to many moments of talentless writing 🙂 … Dame deserve it!

Today I worked a bit above the new NUKI versio. Finally brought order and, and I will fix it shortly before he released the latest stable, and probably final version. So I had the idea to check how many days is the uptime of the host, I do most of my problems have been more time, so I decided to do 10 days a prfilaktičen restart. Hastily lifted me to clear my konveirče days of the remaining variables because the outcome is quite unpleasant uptime otkomandata to work

# uptime
12:13:57 up 30 days, 20:07,  1 user,  load average: 0.00, 0.00, 0.00

So the line is filtered only by superskiâ konveir 😛

uptime | awk -F'up' '{ print $2 }' | awk -F'days' '{ print $1 }'

As if working time is days result a whole number of days, and if it is similar to the rezulatatt

[email protected]:~$ uptime | awk -F'up' '{ print $2 }' | awk -F'days' '{ print $1 }'
1:34,  5 users,  load average: 0.46, 0.39, 0.41
[email protected]:~$

Which passes through checking for the type of the value

if echo $days | grep "^[0-9]*$" > /tmp/null
then
   echo "Uptime in days is $days"
else
  echo "Uptime isnt in days"
fi

Just easy and straightforward in if-then structure checks if stoisnota contains only numbers with regular expression grep “^[0-9]*$”.

Eee lived to eat it NUKA 1.0 🙂 Why the version 0.6 I jumped on 1.0 you ask me, well very simple – we already have one 100% NUKA all the requirements, with a few exceptions Cotto will fixna in the future, and more importantly in the current version implemented completely differently. I went back to my old idea of the demon and with a bit of trial and error, this stuff just all worked perfectly. With the server application is yours to enjoy entirely except for one short php skriptche which draws information NUKA-he 🙂

Already achieved almost all with NUKA, where more? Well, Ko, I have to be honest always, maybe more, for example, to think, to make the installation of the script say to do something as easy and understandable even for a non linux user, everything happens with the maximum- less problems for users. But all the time. Currently NUKA among other things, I dobavil module that monitors the server connection, if you disappear restarted. Currently, still I certainly have installed if it works hihihihihi 😆 Abe, as a rule, although this is true, there is something to be desired or a fresh idea from some one after all the head can not think how 2-3-4 or more, even my 😈

ps Again, even under the code name. I believe that I already have a very solid Foundation for whatever I decide in the future to do with my script