svnserve Init script

I was annoyed to have to start the svnserve as a daemon everytime I restarted the machine. I also wanted to use service configuration(GNOME) to deal with the service.

I looked all over the web and failed to find the a good one. So I thought of writing it my self. Last weekend I sat down and wrote the script. Here is the result.

This was tested on fc6 running kernel 2.6.20-1.2962.fc6. Subversion 1.4.2 (subversion-1.4.2-2.fc6). It should work in any distro with init.

To make service configuration aware of svn serve you will have to first copy the script to /etc/init.d and then run the following.

$ /sbin/chkconfig ---add svnserve

Also remember to create the configuration(/etc/sysconfig/subversion) file with the following lines in it to enable threading.

OPTIONS="--threads"

You can put any options you could send to svnserve in the configuration file.

PS: here is the Init script it self for your viewing before downloading

#!/bin/bash
#
# /etc/rc.d/init.d/subversion
#
# Starts the Subversion Daemon
#
# chkconfig: 2345 90 10
# description: Subversion Daemon
# processname: svnserve
# pidfile: /var/lock/subsys/svnserve

source /etc/rc.d/init.d/functions

[ -x /usr/bin/svnserve ] || exit 1

### Default variables
SYSCONFIG="/etc/sysconfig/subversion"

### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"

RETVAL=0
prog="svnserve"
desc="Subversion Daemon"
pidfile="/var/run/$prog.pid"

start() {
echo -n $"Starting $desc ($prog): "
daemon $prog -d $OPTIONS --pid-file $pidfile
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/$prog
fi
echo
}

obtainpid() {
pidstr=`pgrep $prog`
pidcount=`awk -v name="$pidstr" 'BEGIN{split(name,a," "); print length(a)}'`
if [ ! -r "$pidfile" ] && [ $pidcount -ge 2 ]; then
pid=`awk -v name="$pidstr" 'BEGIN{split(name,a," "); print a[1]}'`
echo $prog is already running and it was not started by the init script.
fi
}

stop() {
echo -n $"Shutting down $desc ($prog): "
if [ -r "$pidfile" ]; then
pid=`cat $pidfile`
kill -s 3 $pid
RETVAL=$?
else
RETVAL=1
fi
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$prog
rm -f $pidfile
fi
return $RETVAL
}

restart() {
stop
start
}

forcestop() {
echo -n $"Shutting down $desc ($prog): "

kill -s 3 $pid
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$prog
rm -f $pidfile
fi

return $RETVAL
}

status() {
if [ -r "$pidfile" ]; then
pid=`cat $pidfile`
fi
if [ $pid ]; then
echo "$prog (pid $pid) is running..."
else
echo "$prog is stopped"
fi
}

obtainpid

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
RETVAL=$?
;;
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
RETVAL=$?
;;
status)
status
;;
forcestop)
forcestop
;;
*)
echo $"Usage: $0 {start|stop|forcestop|restart|condrestart|status}"
RETVAL=1
esac

exit $RETVAL

Installing Huawei ETS1000 on Linux

*** Update for Ubuntu 8.10 ***

You will have to copy the driver files to the correct location. Please run the following command.

sudo cp /lib/firmware/$(uname -r)/ti_3410.fw /lib/firmware/ti_usb-3410.bin

***

I managed to install my ETS1000 Series Fixed Wireless Terminal on Linux and go online. I thought of sharing the steps I took to install the modem on Linux such that you might be able to help someone with the same problem. This should work for any of the CDMA modems that will be using TI USB 3410 cable (the cable you get when you pay for Bell Net) as the problem is with the USB/Serial Cable not the HUAWEI modem.

System Requirements

* Linux with kernel above 2.6.** (Check it by command in console uname -a).
(Personally Tested on FC6, should work on any Linux Distribution)

Let’s Start

It is well assumed that Linux is up on your system and your USB/Serial cable is plugged in.
Now in console type command dmesg -c search for the following lines

ti_usb_3410_5052 1-1:2.0 : TI USB 3410 1 port adapter converter detected
usb 1-1: TI USB 3410 1 port adapter converter now attached to /dev/ttyUSB0

If u even see ttyUSB0 in the kernel message then also your modem is detected and you are ready to start,now just configure your wvdial.conf in /etc and start your dialup.

If not then possibly u will be seeing the following error messages in bundle but i will paste only two lines here.

ti_usb_3410_5052 1-1:1.0: TI USB 3410 1 port adapter converter detected

ti_usb_3410_5052: probe of 1-1:1.0 failed with error -5

Note that the problem is only the USB/Serial Cable not the HUAEWI modem.

Now we have to make one rule file in /etc/udev/rules.d/026_ti_usb_3410.rules

The file may not exist, but don’t worry.

In console login as a root

su

password *****

cd /etc/udev/rules.d/

vi 026_ti_usb_3410.rules (Now Paste the following lines in it)

SUBSYSTEM=="usb_device" ACTION=="add"
SYSFS{idVendor}=="0451",SYSFS{idProduct}=="3410" \
SYSFS{bNumConfigurations}=="2" \
SYSFS{bConfigurationValue}=="1" \
RUN+="/bin/sh -c 'echo 2 > /sys%p/device/bConfigurationValue'"

SAVE AND EXIT (:wq)

Now once again plug out ur USB/Serial cable and then plugin.

Again type dmesg -c in console

Check the kernel message and find the following line

ti_usb_3410_5052 1-1:2.0: TI USB 3410 1 port adapter converter detected
usb 1-1: TI USB 3410 1 port adapter converter now attached to /dev/ttyUSB0

CONGRATULATIONS it is finally done.

Now edit your /etc/wvdial.conf (Mine as a Sample below working fine)

My /etc/wvdial.conf

[Dialer ptcl]

Modem = /dev/ttyUSB0

Baud = 230400

Phone = #777

Init1 = ATZ

Stupid Mode = 1

Dial Command = ATDT

Username = YourUsername

Password = YourPassword

PPPD Options = crtcts multilink usepeerdns lock defaultroute

Important Note: Stupid Mode should be set to 1 otherwise the hash sign # with Dialing phone number will not be treated by wvdial.

LAST PROBLEM

When u will connect to ptcl with wvdial ptcl command as a root , it will not browse any page and will disconnect.

You have to set the nameserver in the /etc/resolv.conf .You can get the nameserver IPs from the terminal window when wvdial is trying to connect to your ISP.

Put those two nameserver in /etc/reslov.conf.

Now again as a root in console wvdial ptcl.

FINALLY YOU ARE DONE.

DVD movies on mplayer – Excellent

I bought my self a Shrek2 (know it is old, but didn’t want to spend too much) DVD and wanted to check how well mplayer will handle it. To my surprise, there wasn’t a glitch. The movie was crystal clear. It’s as good as watching on a DVD player.

So I thought I would do more research and find out how mplayer decode the DVD so well without even loading the processor so much. To much of my surprise player does support hardware decoding of DVDs via graphic card (I have a nVidia GeForce with nVidia proprietary drivers). This is only supported in one of nVidia’s own media player when it comes to Windows, but mplayer did it.

Thanks allot for the mplayer project for a such a feature rich application.

Installing Lexmark X1100 series on fc6

I unfortunately bought a Lexmark X1170 all in one two years back, it was cheap and got both printer and scanner. It worked fine on Windows. It was just paper weight ever since I moved to Linux.

I struck luck yesterday, when I stumbled upon a forum posting on Ubuntu forum.

So I started out straightaway, but had trouble getting the correct drivers from Lexmark site, as instructed in the forum (Got 404). So I went and searched in opendrivers.com and fortunately found it. To help all the poor soles to get the drivers easily I have hosted the rpms. If you download these rpms you can skip the part upto converting the rpms with alien if you are using a debian based system, or install the rpms and continue from restarting CUPS.

Here are the links:
http://www.mohanjith.net/downloads/d…1.0-1.i386.rpm
http://www.mohanjith.net/downloads/drivers/printers/lexmark/z600llpddk-2.0-1.i386.rpm

The instructions worked like a charm, and now I’m making use of my printer finally. From my point of view X1100 series is a repackage of Z600 series with a scanner.

Even though the scanner was correctly detected by SANE, I was unable to scan. But the version of sane that comes with Fedora Core 6 (Zod) is old.

Grinding your web application

Have you ever wondered how your web application/site would behave under heavy load? You can easily check that if you have enough bandwidth. You can use a stress testing automation tool.

I got the oppertunity to load test open source application OrangeHRM. I used Grinder, java load testing framework with JWebUnit, automated navigation and content verification framework for testing web applications/sites. Both tools are open source.

Only references that I used are that of the two tools. I managed to create the test and learn (J)Python as well within 8-12 hours.

Unfortunately I was unable to overload the server and get any errors because my machine was incapable of making enough concurrent requests to the web server running on the same machine. The Grinder was unable to run more than 250 requests, because the web server also requires resources.

Beryl – Eye candy for linux desktops

If you think Linux is boring, lacks eye candy you find in Windows (esp. Vista); you haven’t seen a Linux desktop running Beryl.

Beryl has added all the eye candy that Linux desktops lacked, now definitely it looks better than Windows XP and in my opinion better than Windows Vista as well.

Here are some screen shots to prove it. 😉 (it is not faked)
Running: Fedora Core 6, GNOME
Desktop cube:


Rain effect (Purely eye candy):

Creating ISO images of CDs in a flash

Have you sometimes wanted to copy a cd image to your hard disk while you are using linux/unix. Here is a simple way that requires no additional packages, but no GUI,

dd if=/dev/cdrom of=/tmp/cdimage.iso

If you insist on a GUI, you could give a try to GnomeBaker as well. If you are using yum on fedora core 6 use yum to
installGnomeBaker.

yum install gnomebaker

GnomeBaker can burn cds as well, but there a few minor bugs; no harm will be done to your burner or disk. I
managed to successfully burn a Ubuntu Live CD and boot from it, that is enough assuarance for the moment.

GNOME Sensors Applet

That’s a cool desktop applet to show the systme temperature, fan speed, voltage, etc.

After I got lm_sensors running I wanted to get the sensor information on my desktop running GNOME. I installed GNOME Sensors Applet using yum (yum install gnome-applet-sensors).

It showed three temperatures(Only two successfully, other with an error), and I removed one. Two temperatures must be mother board and cpu temperature.

You should give a try to GNOME Sensors Applet, if you miss the Windows applets that are usually provided by the mother board manufacturers or just curious.

Cool applet, thumbs up Alex Murray and lm_sensors project