OpenCoffee Ioannina I – Τα πρακτικά

Ένα post για το πώς πήγε το πρώτο OpenCoffee event στα Ιωάννινα υπάρχει στο: http://opencoffee.gr/2008/05/13/opencoffee-ioannina-i-minute/

shell history meme

Since I am not using bash but zsh, I had to modify the notorious command to suit me:
% cat .zsh_history| awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}'| sort -rn|head
404 vim
363 mv
295 cd
226 ls
209 scp
189 rm
176 dig
170 mplayer
164 eix
163 svn

PGP Keysigning Party στη Θεσσαλονίκη

*UPDATED με ώρα/μέρος*

Την Τετάρτη 23 Απριλίου του 2008 στη Θεσσαλονίκη θα διεξαχθεί συνάντηση για συλλογή/ανταλλαγή υπογραφών σε pgp/gpg κλειδιά. Για τη συμμετοχή σας θα χρειαστείτε κάποιο επίσημο έγγραφο που να πιστοποιεί την ταυτότητα που αντιστοιχεί στο κλειδί σας, και αρκετά αντίγραφα από το ψηφιακό δακτυλικό αποτύπωμα του κλειδιού σας και του ονόματός σας γραμμένα σε χαρτί.

Περισσότερες πληροφορίες για τη διαδικασία που θα ακολουθηθεί (Informal Method Party) υπάρχουν εδώ.

Το ακριβές μέρος και η ώρα θα ανακοινωθούν μέσα τις επόμενες μέρες.
Το meeting θα γίνει μάλλον σε cafe της πόλης ώστε να μπορέσουμε να συζητήσουμε και να γνωριστούμε καλύτερα.

Όσοι πιθανώς ενδιαφέρονται ας κάνουν ένα comment εδώ ή στο blog του Πάτροκλου για να μετράμε συμμετοχές έστω και στο περίπου.

*Update*
Ημερομηνία συνάντησης: Τετάρτη 23/04/2008
Ώρα: 16:30
Μέρος: Καμάρα Θεσσαλονίκης

Greek gentoo users unite!

Aggelos Orfanakos, one of the two greek gentoo developers, has created a google map where every gentoo user in Greece can place his coordinates so we can easily spot each other and maybe “create” a community, do some meetings and have some fun 🙂

You are all welcome to join!

Gentoo Users in Greece

playing with QR codes

While fooling around on the net today I bumped into QR codes. I had seen them on some contact cards and some websites before, but I didn’t really pay any attention back then.

Creating a code is easy, there are a bunch of ways to do it. Nokia has a generator offering two modes, Datamatrix (default) and QR (look at the bottom of the page): http://mobilecodes.nokia.com/create.jsp.

Reading the code is quite easy too. You just need a code reader for your mobile phone. Nokia’s reader couldn’t work on my Nokia N70 but Kaywa Reader worked just fine. Go the their site, login with bugmenot and download the reader for your own mobile phone.

Then just play with it.

Here’s how it looks like:

Weird(?) thing is that I couldn’t find any applications for linux (open source if possible) to able to “ocr” the images and provide output of the code inside them. Do you know any ?

How to standardize an error

All software companies make errors.

A great deal of those companies correct these errors as soon as someone finds them.
A few companies correct them as soon as they can. But that can sometimes take months.
One company not only does it not correct the errors it makes, it tries to standardize them.

It’s not about how big or small an error is…it’s about the attitude.

Annoying spam from Magenta

Magenta is a greek software company which among others has a product called OfficeSuite 2008 Professional, which is based on OpenOffice. Nothing bad in that. This is very good news indeed.

The last couple of days though they have been spamming the “Greek internet” with emails about their wonderful product. I got the same spam to at least 4 different emails and mailing-lists that I am subscribed. It’s very very annoying. It is also known that magenta’s people have been reading emails on some of those lists, they have used them in the past, but none came forward these last couple of days to say that they are sorry for spamming us and that it won’t happen again, etc, etc. Advertising is one thing, spamming is something very very different. I expected that company to be a bit more serious about their marketing tactics, shame on them.

All spam emails come from the address: listmaster@magentadb.gr If any mail administrators are out there…PLEASE PLEASE block them.

imageshack.py

This python script is usefull for uploading images to imageshack via the command line.

The original script found in an old post in python’s mailing list is not complete. A user with nick Agiofws on GrIRC-net expanded it a bit and used it together with a bash script in order to get the url of the uploaded image. What I did was to implement a regexp search for a “paste-friendly” url at the bottom of the python script.

Feel free to use it, and change it as you wish: imageshack.py.gz (You need to gunzip it first.)

pysmssend

pysmssend is a utility to send sms over some internet gateways. It currently has support for 3 ISPs, Otenet, Voipbuster and Voipdiscount. There are 2 ways to use it, either with a QT4 gui or by command line. It also has some, experimental at the moment, support for address book (gui only).

Since I liked the idea behind the utility I contacted the author and helped him by providing some ideas and a few fixes. I’ve also created an ebuild for it.

You can find more info about the utility and see some screenshots on the pysmssend kde-apps site since the utility’s website on sourceforge is not yet ready and has only the ebuild and a pkgbuild for Arch Linux.

Its command line usage combined with a monitoring package that supports external commands when something important has happened, can prove very handy. I hope Markos (the author) will keep on fixing bugs and improving the utility 🙂

XHTML 1.1 validation

I’ve finally managed to get the theme for my blog XHTML 1.1 validated. The first time I checked it with W3C Markup Validator it had 99 errors. Most were about some br and ul,li tags. The part that I had some difficulty into making it valid, was meebo’s chat flash code. Meebo serves this to paste in websites:

<!-- Beginning of meebo me widget code. Want to talk with visitors on your page? Go to http://www.meebome.com/ and get your widget! -->
<embed src="http://widget.meebo.com/mm.swf?EunEtULzWx" type="application/x-shockwave-flash" wmode="transparent" width="160" height="250"></embed>

Which is not XHTML 1.1 valid. To make it valid I transformed it to something like this:

<object type="application/x-shockwave-flash"
data="http://widget.meebo.com/mm.swf?EunEtULzWx"
width="160" height="250">
<param name="movie"
value="http://widget.meebo.com/mm.swf?EunEtULzWx" />
<img src="noflash.gif"
width="160" height="250" alt="" />
</object>

according to this: Flash Satay.

You can now check the validator that my blog is OK 🙂

References:
http://learningforlife.fsu.edu/webmaster/references/xhtml/tags/
http://alistapart.com/articles/flashsatay

Beep! Beep! Beep! Beep! Beep! Beep!

Facts:
A fileserver based on Tyan Thunder K8SD Pro (S2882-D), equipped with 3Ware 9500S-8 SATA RAID card and 6 Western Digital 250Gb disks as raid5 in 2 enclosures Proware MS-324A and Proware MS-223A. The front door of the server case is locked with a key that the owner does not know where it is, no buttons are available outside the door (no power/reset/etc buttons). The server is running Gentoo Linux.

The day starts:
08:55 – Mobile phone rings. I wake up but I don’t pick it up since I am unable to speak on the phone due to sleepiness. I am thinking that there is absolutely NO way something good is ever going to come out of a phone ringing that early.
09:05 – I wake up, check the phone and CallerID says that is one of the customers that I do tech support for. I call them and ask what’s the problem. Conversation follows:

Me: Hello, good day, what’s the problem and you are calling me so early ?
Customer: Oh sorry, did I wake you up ?
Me: It’s ok, I was just about to wake up (HUGE LIE)…
Customer: The fileserver keeps beeping today as it did last night.
Me: Beeping ? Why didn’t you tell me yesterday ?
Customer: I didn’t think it was of any importance, so last night I pulled the plug to make it stop beeping.
(That’s when my lower jaw reached my desk. Remember that the front door is locked, he has no access to buttons and of course he has no Linux knowledge in order to ssh and power it off. Why didn’t he call me last night to do it though ???)
Me: You did what ? You pulled the plug ? And today you put it back online ? And it beeps again ?
Customer: That’s right. Do you know what is the problem ?
Me: No, but let me login remotely to the machine and I’ll take a look. I’ll call you back soon to tell you what’s going on.

First checks:
I ssh to the machine and start checking /var/log/messages. After some searching I find this:
3w-9xxx: scsi0: AEN: WARNING (0x04:0x0042): Primary DCB read error occurred:port=2, error=0x208.
I google for it and at the same time login to IRC to ask some friends if they know anything about that error. Noone seems to have met that before. Some websites say this error is of no importance. Some others say it is very important and that I should call the vendor. I go to 3ware’s site and start searching the knowledgebase. I find these pages:
a)http://www.3ware.com/KB/article.aspx?id=14335
b)http://www.3ware.com/KB/article.aspx?id=14687
c)http://www.3ware.com/KB/Article.aspx?id=12072
I also check the status of the array using tw_cli (3Ware Command Line Utility). It says that is verifying the array, probably due to the plug pulling the customer did.

I call the customer and tell him that the array is being verified and that I will call him back as soon as it finishes.

11:30 – The verify process ends. All is fine with the array.
11:32 – I call the customer and ask him if the beeping has stopped. He tells me that the beeping keeps on.
11:34 – I reboot the server and check the messages again. I now get
c0 [Fri Aug 31 09:42:53 2007] WARNING (0x04:0x0042): Primary DCB read error occurred: port=3, error=0x208

But no verifying process starts. I manually start a verifying process while examining various commands that the tw_cli provides. I ask another friend on IRC and he suggests that some disks might be failing.

Time for some face to face contact:
11:50 – I call the customer again and tell him that I am taking a taxi to go there in order to take a “closer” look.
11:55 – I am waiting for a taxi.
12:10 – Still waiting
12:15 – A taxi comes, I argue with an old man who is trying to take my turn for the taxi. I tell him that I have to go to a hospital immediately so he steps back.
12:25 – I arrive at the customer. The beeping sound can be heard all over the place and even though the server is in a seperate closed room one can hear it from 2 rooms beside.

I take a monitor and a keyboard from another PC and plug them to the fileserver, I reboot it and enter 3Ware’s BIOS. No alarms/no errors are shown. I reboot it and start checking the motherboard’s BIOS. PC Health Status looks fine (the room is airconditioned with a stable temperature of 21 degrees Celcius). I boot into Linux again. No errors at /var/log/messages or through tw_cli but the server keeps beeping. I am by then totally puzzled. I enter 3Ware’s site to create a customer account and open a trouble ticket. I take messages shown from tw_cli show diag command and the previous errors that I posted above along with various data from the machine to fill the needed details. I know that I won’t have an answer for at least 4-5 hours due to time difference with US so I start messing around with the controller through tw_cli trying to find any clues.

13:30 – Since it’s friday and the RAID5 array has no spare drive I decide to order one drive like the others from an online shop. Even if no drive at the moment has a problem it won’t hurt to have a spare drive for the future.

I am also trying to help people continue to do their jobs without the company’s fileserver while messing around with the controller. I run smartctl for every disk to check their SMART attributes using something like:smartctl -a -d 3ware,2 /dev/sda. No errors at all from any disks. Temperatures normal. Then “-t short” SMART tests, no errors.

A strange idea:
14:30 – People have started leaving the company for noon break. I stay.
14:40 – I strange idea comes to mind. What if I remove the 3ware card ? Will the beeping stop ?
14:45 – I start to unscrew the box to pull the 3Ware card out of it. No success. The beeping continues.
14:55 – I pull the power plugs off the first enclosure, the Proware MS-324A. No success. The beeping continues.
15:00 – I pull the power plugs off the second enclosure, the Proware MS-223A. THE BEEPING STOPS!
15:05 – I put back on the power plugs of the MS-324A. NO BEEPING.

So I have found out whose fault is the beeping, right? I try to take the MS-223A out of the server box. The process is rather tricky due to faulty screws or screws improperly screwed (don’t laugh!) by the company who assembled the server (not me! NOT ME!!). I finally manage to take the enclosure away from the box and blow the dust away from it. While doing that I notice that one fan is not acting like the other 2 while I blow air at it. It doesn’t “turn” as fast as the others do. I put some plugs to the enclosure and I start the machine again. The beeping starts but what is clear is that one fan has a spinning problem, I guess it’s due to dust. I try to find the manual of MS-223A on the web. That’s where I notice this:
When a fan's rotation speed is lower than 1000rpm the buzzer will sound.

Trying to fix the problem:
I am now certain of who’s to blame. I try to unplug the fan from the enclosure and put back the enclosure to the server box. It keeps beeping.

16:00 – I start searching for a spare 60mm fan with a 3pin molex. Of course I can’t find any at the customer’s place. I go out and search the neighborhood for a computer store. I am lucky (you can laugh here) and I see a guy just enter his computer store, I go inside and ask him if he has any of the fans that I want. He doesn’t.
16:30 – I am back at the customer’s place. I order 3 60mm fans with a 3 pin molex from the net. Having some spare fans in the future sounds very very good to me.
17:30 – The customer and his employees come back at the company and I explain to him what has happened. I am shocked to learn by other employees that they often heard it beeping again in the past but nobody cared to tell me.
18:00 – I read my emails and 3ware’s support has replied to my case. They propose to download some other diagnostics and do some tests.

I was too tired to test the controller with the new diagnostics. Since it’s friday and the company closes for the weekend I will run the tests when I have the 60mm fan replaced. Until then (which could easily be tommorow if the fans arrive), I’ve shut the server down, just to be sure that there’s nothing wrong with the controller or any of the disks.

Conclusion:
I am almost sure that if it hadn’t been for the beeping sound I wouldn’t even have noticed 3ware’s “errors” which were probably caused by the pulling of the main plug of the PSU. It might sound a bit strange, but I don’t actually worry about the diagnostics test that 3ware’s customer support proposed. I am very impressed by 3ware’s customer support and responsiveness. I don’t know how all this will end yet, but I think it will all be fine by the time I replace the fan.

DAMN FAN! YOU RUINED MY DAY.

I still hear this “Beep! Beep! Beep! Beep! Beep! Beep!” sound inside my ears.

simple shell script to download the frontpage of major greek newspapers

www.in.gr has a very usefull feature on their site, it has all major greek newspapers’ front page scanned and posted in a place called kiosk.

Even though this is very nice, it doesn’t fit my viewing needs, I want all newspapers on my local drive every morning so I can view them with my favorite image viewer. In order to do so I created a small shell script.

The script:

#!/bin/sh
#simple shell script to download the frontpage of major greek newspapers from www.in.gr/kiosk/
#feel free to modify it as you wish :)
YEAR=`date +%Y`
MONTH=`date +%m`
DAY=`date +%d`
mkdir -p ~/in.gr/${YEAR}/${MONTH}/${DAY}/
cd ~/in.gr/${YEAR}/${MONTH}/${DAY}/
i="0"
j="0"
k="0"
exclude=(30 31 32 33 34 58 60 61 69 78 79)
include=()
while [ "$i" -lt 80 ]; do
if [ "$i" = "${exclude[$j]}" ]; then
echo "excluding $i"
j=$[$j+1]
i=$[$i+1]
else
wget -q -nc -c http://assets.in.gr/dGenesis/assets/Content60/Issue/${YEAR}/${MONTH}/${DAY}/${i}_h.jpg
i=$[$i+1]
fi
done
include_len=${#include[*]}
while [ "$k" -lt $include_len ]; do
wget -q -nc http://assets.in.gr/dGenesis/assets/Content60/Issue/${YEAR}/${MONTH}/${DAY}/${include[$k]}_h.jpg
k=$[$k+1]
done

Just add the script to your user’s crontab and you are ready. Since not all newspapers come out in the morning at the same time, you can add that script to run on your crontab every one hour in the morning from 7 o’clock until 12 o’clock.

Some details:
The kiosk has an interesting and weird “feature”. To find a newspaper’s ID-url you can go to www.in.gr/kiosk/ and click on the newspaper you want. A window with a thumbnail will appear, click on the thumbnail and a new pop-up window with a bigger image will come forward. Now right click on the image and select copy image location. It should be something like: http://assets.in.gr/dGenesis/assets/Content60/Issue/2007/08/29/3_h.jpg. Even though most newspapers feature sequential numbering until number 34, some come with a higher number like 53, 60, 61, 78, 79. So while one might think that it’s safe to iterate until 80 to catch them all, that’s not the case. Some sports and all local newspapers have ID numbers like 69389! In order to cope with these, for anyone who might want them, I added another loop in the script that uses an “include” array. Put any high numbers above 80 inside the include array (seperated by a whitespace) and the script will download them. Since I don’t like reading sports and gossip newspapers I have added an exclude array in the main loop in order to avoid downloading them. If you want to download all newspapers simply remove the numbers I have in my exclude list.

I don’t understand what’s the purpose of having both small sequential numbers and bigger “random” ones as IDs. Do you ?

Oneliner: text to image using imagemagick

$ convert -size 200x30 xc:transparent -font /usr/share/fonts/dejavu/DejaVuSansMono.ttf -fill black -pointsize 12 -draw "text 5,15 'this is just a test'" test.png

The result:

With this oneliner it’s very easy to create images of e-mail addresses for anti-spam purposes (pretty old-fashioned though).

more netroute2 hacks – new traffic shaper

On my previous post, more netroute2 hacks – high availability, one of the changed files was the dial_conn file. At the end of the diff there was a line with a # in front:
+ sleep 5
+ #/etc/bin/wshaper ppp0 192 1024

Inside netroute2 one can find the /etc-ro/ppp/wshaper file which is the traffic shaping script of the modem/router. Unfortunately it resides in the read-only section of the router so you can’t make changes directly to it. What I did was to make a copy of it on the writable /etc/bin/ and change a line in my /etc/bin/dial_conn to call it from there, right after (5 seconds later) the connection with the ISP has been established.

If you have followed the previous post about high availability the only thing you need to change is to edit your /etc/bin/dial_conn file and remove the # from the live above. Else…read the previous post 🙂

The first argument of the script is the device the rules will apply to, the second argument is the upload speed and the third is the download speed. Netroute2’s own traffic shaping script gets the 3 arguments while syncing with the dslam. The problem with adsl lines here in Greece, and I guess in many other countries as well, is that the speed the modem syncs with the dslam has nothing to do with the real speed you actually get. So shaping for 256kbit upload while never reaching more than 200 is a bit foolish imho. What I did was lower the upload so that I am always (or mostly always) sure that this is my max upload speed at the time. I can now create rules based on the assumption that my upload speed is 192kbit. If the upload speed your modem syncs is 192kbit I would advise you not to put more than 128kbit as the first argument. It’s a trial and error situation.

While lowering my shaped upload speed and keeping the rest of the script intact already made a difference I knew that I could do some more tweaking.
The first thing one has to know before creating any traffic shaping script is to learn what the TOS field is:

#TOS FIELD
# 0x10 – (minimize delay)
# 0x08 (maximize throughput),
# 0x04 (maximize reliability),
# 0x02 (minimize cost)
# 0x00 (best effort)

You can then create rules with iptables to change the TOS field of certain packets, for example:
$IPTABLES -t mangle -A POSTROUTING -o $DEV -p tcp --syn -m length --length 40:68 -j TOS --set-tos 0x10
$IPTABLES -t mangle -A POSTROUTING -o $DEV -p tcp --tcp-flags ALL ACK,FIN -j TOS --set-tos 0x10

A great rule to add to any of your scripts is to speed up ACK packets,(2) by adding them to the highest priority class (on netroute2 that’s 1:10):
$TC filter add dev $DEV parent 1: protocol ip prio 1 u32 \
match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:10

What is also very very helpfull is to specify the port your torrent client uses (eg 17777) and add it to the lowest priority class (on netroute2 that 1:30):
$TC filter add dev $DEV parent 1:0 protocol ip prio 3 u32 match ip sport 17777 0xffff flowid 1:30
$TC filter add dev $DEV parent 1:0 protocol ip prio 3 u32 match ip dport 17777 0xffff flowid 1:30

Of course you can create your own classes inside /etc/bin/wshaper. If you are carefull enough with the rules you add you will be more than happy with the result 🙂

To monitor how your traffic shaping is going you can download a great perl script from here: http://qos.kallenberg.dk/ called qos.pl. This script reads a machine’s qos classes and priorities and creates graphs like the ones on the site. The problem with netroute2 is that it doesn’t have perl included, so one has to modify qos.pl to make it read netroute2’s qos performance while running from another machine. This is done by making the script run its commands through ssh-ing to netroute2 using public key auth. If you don’t know how to enable this on netroute2 please read part F of my older post: Intracom netroute2 hacks/.

What you need to change on the qos.pl script is:
a) change the $tc line with something like this:
$tc = "ssh root\@NETROUTE2.IP.GOES.HERE /usr/sbin/tc";
b) Find any occurances of “eth2” and replace with “ppp0” (there must be 2 occurances only).

now run the qos.pl script and it will start creating some graphs (png files) and an index.html on the directory from which you executed it. qos.pl depends on gnuplot, so you must install it before you run it.

The graphs are a great visual aid to to tweak your new traffic shaping script more and more.

more netroute2 hacks – high availability

The following post is going to be a one in a series of 2-3 posts regarding netroute2 (the link is in Greek) and some of my hacks/modifications on it. All hacks refer to netroute2 firmware 577 that I have previously posted on my blog. For those who haven’t noticed yet, firmware 577 is unlocked, you can now connect to any ISP you like.

Netroute2 has a strange bug and sometimes (not always) cannot reconnect to the ISP when the connection for some strange reason goes down. To cope with that, the netroute2 developers at Intracom have created a script named high_avail that runs every 5 minutes from crontab. For some even stranger reason this script did not work for me as it should, so I patched it to make it _always_ work.

The problem I faced at the very beggining was that the “high_avail” script resided in the read-only section of netroute2’s flash (/usr/bin/high_avail). My solution to that problem was to create a directory named /etc/bin/ and store there all my new scripts and changes since the /etc dir is writable.

My changes to the high_avail script are these:
--- usr/bin/high_avail 2007-07-03 20:59:21.000000000 +0300
+++ etc/bin/high_avail 2007-07-04 03:31:54.000000000 +0300
@@ -15,25 +15,32 @@
if [ -s /var/run/dial ]; then
act_conn=`$CAT /var/run/dial`
fi
-adsl_iface=$ADSL_BASE
+if [ -z "$act_conn" ]; then
+ act_conn="/etc/wan/current/CHANGEME"
+fi
+
+adsl_iface=$ADSL_BASE
+echo "$act_conn"
reload_module() {
/bin/hangup
+ killall -9 pppd
+ ifconfig eth2 down
/sbin/rmmod $loaded_mod
if [ $? -eq 0 ]; then
$ECHO "done"
else
$ECHO "failed"
$ECHO "ERROR: high_avail: Failed to unload $loaded_mod"
- exit 13
+# exit 13
fi
- [ -n "$act_conn" ] && /usr/bin/dial $act_conn
+ [ -n "$act_conn" ] && /etc/bin/dial $act_conn
}
HIGH_AVAIL_IP=`$GREP HIGH_AVAIL_IP /etc/net.conf | $CUT -d'=' -f2`
-
#Check Current Modem status
if [ -z "$loaded_mod" ]; then
$ECHO "high_avail: No Module found loaded."
+ reload_module
exit 1
elif [ "`/usr/bin/modem_wrap halt`" = "yes" ]; then
$ECHO "high_avail: Module $loaded_mod found in HALTED state"
@@ -41,6 +48,7 @@
exit 11
elif [ -z "$act_conn" ]; then
$ECHO "high_avail: No WAN Connection dialed ..."
+ reload_module
exit 2
elif [ -z "$HIGH_AVAIL_IP" ]; then
$ECHO "high_avail: No Ping Target IP Found ..."

and the whole new script resides here: /etc/bin/high_avail. (You need to gunzip it).

What you need to change for your connection is the part that says CHANGEME. You can replace that with what you can find inside the /etc/wan/current/ directory.

I noticed that when the module for the modem was loaded then the modem was unable to reconnect to the ISP, but upon unloading and reloading of the module, and then trying to connect again, all came back to normal. So what I changed in the high_avail script was making sure the module gets unloaded properly and reloaded when there’s no connection active.

One might notice that inside high_avail I’ve also changed a path from /usr/bin/dial to /etc/bin/dial.
This script is used to call another script that actually makes the call to the isp.

--- usr/bin/dial 2007-07-03 21:00:13.000000000 +0300
+++ etc/bin/dial 2007-07-04 03:39:45.000000000 +0300
@@ -1,25 +1,16 @@
#!/bin/sh
ECHO=/bin/echo
-
conn="$1"
#ATM encapsulation mode for modem
encmode=0
-
$ECHO "Dialing $conn ...."
-
if [ $# -lt 1 -o ! -e $conn ]; then
-
$ECHO "Usage: dial <connection> [ppp_option]"
$ECHO "connection: connection name"
$ECHO "[ppp_option]: optional argument passed to PPPD"
-
exit 1
-
else
-
#Bring down previous processes
/bin/hangup
-
- /usr/bin/dial_conn $conn primary_conn $2
-
+ /etc/bin/dial_conn $conn primary_conn $2
fi

These are my changes to /usr/bin/dial script that is now placed under /etc/bin/dial
The whole scripts resides here: /etc/bin/dial. (You need to gunzip it).

As said before, this script in turn calls another one, dial_conn which is used to actually make the call. My changes to /usr/bin/dial_conn which now becomes /etc/bin/dial_conn:


--- usr/bin/dial_conn 2007-07-03 21:00:13.000000000 +0300
+++ etc/bin/dial_conn 2007-07-04 03:43:11.000000000 +0300
@@ -154,14 +154,13 @@
exit 1
fi
done
-
fi
-
if [ "$2" = "primary_conn" ]; then
#Start the high-availability service
- $ECHO "*/5 * * * * root $PIDOF high_avail > /dev/null 2>&1 || /usr/bin/high_avail > /var/run/high_avail 2>&1" > /etc/cron.d/cron_high_avail
+ $ECHO "*/5 * * * * root $PIDOF high_avail > /dev/null 2>&1 || /etc/bin/high_avail > /var/run/high_avail 2>&1" > /etc/cron.d/cron_high_avail
$CHMOD 755 /etc/cron.d/cron_high_avail
fi
-
+ sleep 5
+ #/etc/bin/wshaper ppp0 192 1024
exit 0
fi

the whole file resides here: /etc/bin/dial_conn. (You need to gunzip it).

What I’ve changed here is the line that gets stored on crontab and calls the high_avail script every 5 minutes to check whether our connection is active or not. The rest of the changes will be the subject of the next post about netroute2 on this blog.

What is left now is to make netroute2 calls these new scripts from /etc/bin/ on boot instead of the ones from /usr/bin.

a) Copy /bin/dial_current to /etc/bin/dial_current, edit it with vi and go to line 5 and change the line that says /usr/bin/dial with /etc/bin/dial.
b) Edit /etc/init.d/rc-run, go to line 243 and change all occurences of /bin/dial_current with /etc/bin/dial_current. There must be 2.
c) Edit /etc/rc.d/rc.dialcurrent with vi, go to line 8 and change /usr/bin/dial to /etc/bin/dial.

So, if you have done it right, you should now have 4 scripts inside your netroute2’s /etc/bin:
a) /etc/bin/high_avail
b) /etc/bin/dial
c) /etc/bin/dial_conn
d) /etc/bin/dial_current
and you should have also changed 2 scripts, /etc/init.d/rc-run and /etc/rc.d/rc.dialcurrent

That’s all. Now save your changes with /etc/init.d/checkpoint and upon reboot your modem will have a nice new high_avail script that will (hopefully) always work.