![]() |
Main Menu Programming Released Not Released Teamwork Dev Schemes Dev Plans ![]() |
The Shiny Bash Script
Shinystat is a free italian counter that I use on my sites. I was already receiving a daily uptime SMS from The big server, but receiving also a daily report from the counter, wow, would have been a great relief! For I was just studying bash scripting I thought I could have fun programming a script for this task... so here you can download the hard work of a whole day :-) But, let's look first at program internals, how does it work? Very simple, indeed. Using wget the program downloads the page from the counter site, then it prints it with lynx, using a command script, so it can lately parse a plain text file, instead of an HTML one. Parsing this text file with awk is very simple, so we now have a multi line output of the selected informations, the last step is to pipe the output of the script with a little C program (monoline) which just make it a single line, ready to be passed as a message argument of smssend. All you have to do in order to receive the daily report is to register to a smssend supported provider, then put a line in your crontab that runs smssend with the shiny script output as the message. For example, this is my crontab entry, a report every day at 12:00 : 0 12 * * * smssend 1rstwap user pass 0 "`./shiny.sh user | monoline`" I suggest you to use 1rstwap as the provider, it is international and supports long message without problems. |
![]() ![]() ![]() ![]() ![]() |
©2002-2009 Angelo Theodorou |