Installing GNU Screen in ESX server

28/08/2009

Today, I am forced to login into my ESX servers. Some accidents happened and my virtual servers went down. Seems to much snapshots i have made using a scheduler and fill up my datastore entirely.

There is only 2GB left from 500GB of storage. Therefore my machine cannot boot anymore. I tried to use VMware Virtual Client to move some of virtual disks but seems my network was so intermittent and the operations failed over and over.

Well I need to go inside the ESX and manually move the virtual disks. but that the problem, my network is not reliable. I can just let my ssh sessions interrupted while copying the disks.

And worse, ESX does not have screen installed. Hello! that is my favorite tool while playing in CLI. Seems I have to install one, so I can work anywhere as I in the server myself.

I tried to use Yum. But the Yum in ESX is just meant to use for updates only. What a lame!

More research comes up with ESX is built on RH3. That just cool! Just find any rpm that suite that distros, I think it will fit ESX.

And i found it in rpm.pbone.net! the link is:

http://rpm.pbone.net/index.php3/stat/4/idpl/5245464/com/screen-3.9.15-10.i386.rpm.html

and with a dependency that needed:

http://rpm.pbone.net/index.php3/stat/4/idpl/5246885/com/utempter-0.5.5-1.3EL.0.i386.rpm.html

Now, I have it installed and ready to move my virtual disks to external drive I attached to my ESX server!


Dhcpd service went haywire

11/03/2009

I am having big headache today. My first dhcp servers with failover went into some problem. This is due to unproper shutdown last night. Tenaga Nasional Berhad (TNB)  should inform us that their maintenance took lot of time yesterday. As our UPS batteries is limited to 30-45 minutes, all servers died unexpectedly.

I have two dhcp server running side by side with failover mode. Next day, when everybody just started their working hours ,  i realized then the dhcp service for master server was down.

Tried to troubleshoot, I got this message over and over again. Quite dissappointed because the web is not helping and Uncle G lost his touch today.

Mar 11 19:53:13 ns3 dhcpd: failover peer dhcp-failover: I move from communications-interrupted to startup

Mar 11 19:53:13 ns3 kernel: [   45.856222] dhcpd3[3869]: segfault at 0 ip b7ea329b sp bfd155b0 error 4 in dhcpd3[b7e82000+94000]

Much has been done. I reinstalled the service, fallback to old config, use vmware to fallback to previous states, but i failed.

Until 6 hours later i found the problem. The clock differs a lot. Such a little error and it have the service mess up.  The date between the two servers differs 12 hours.

A very short command recovered the date correctly.

# sudo date 03111451

After that i restart the service and everything when to normal. Such a headache solved with the simplest command.


Ubuntu 8.10: Squid3 with pam_auth revisited

26/12/2008

It has been a long time I have not touch the squid configuration and installation. Recently, when I tried to install it again, I found that the howtos in Internet was a little bit confusing and I did not manage to setup. Until I viewed the log file (/var/log/auth.log) then I understood what went wrong and managed to solve the problem.

My  objective is to create a new proxy server with limited access controlled by using PAM authentication. The original howto is from this page.  I modified it to suit my environment which is using Ubuntu 8.10 server installed on my ESX server (Virtualization is awesome!).

The steps i did:

1. Update the APT installer to find the latest packages

$ sudo apt-get update

2. Installed your squid and any dependencies.
In Intrepix Ibex, they use squid3 name instead of just squid. It made me mistakenly edited the wrong files several times.

$ sudo apt-get install squid3

3. Edit the main configuration files
We need to add 2 entry here to enable PAM authentication and force the PAM authentication. edit the squid.conf.

$ sudo vi /etc/squid3/squid.conf.

and add this lines to enable PAM authentication

auth_param basic program /usr/lib/squid3/pam_auth
auth_param basic children 5
auth_param basic realm Squid
auth_param basic credentialsttl 2 hours

And add this to force authentication to every user using it

# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
acl pam proxy_auth REQUIRED
http_access allow pam

4. Configure the pam modules for Squid
Create a new file with name squid in /etc/pam.d/ and populate with this entry.

$ sudo vi /etc/pam.d/squid

Add the below lines. This is the alteration i did from the previously mentioned  howto.

auth             required        pam_unix.so
account         required        pam_unix.so

5. Start the squid service

$ sudo /etc/init.d/squid start

The service should starts smoothly if you are using the same distro and packages that i used. Actually configuring squid is quite straightforward but maintaining and managing different distros with different styles and packages versions is the confusing part.


Capturing Streaming Video Using DCOP + Xine

13/11/2007

This morning, the Vice Counselor of my university was interviewed on tv. No one is recording the event and I did not notice about it until it is aired. It will be nice if I can always capable of recording such memorable event. Therefore, I began to write a script that can help me to do a scheduled recording.

From the Internet, I notice that this can be done using mencoder or FFMpeg. However due to some circumstances I can’t use these tools on my PC. That leave me no choice but to use xine.

Xine on my desktop is fine enough to capture the shows on tv but the problem is I could not find any way to schedule the recording using GUI. As time pass, the problems reminds me about my favorite command in past, DCOP!!!

I used to play text based games using DCOP. Actually the idea is not to play games but to learn bash scripting. Learning process made me bored. Therefore, I thought, I need a project that could keep me motivated during the process. So I made a robot that could help me to play games without really touch the game daily. So that was the moment I enjoys using DCOP and the fun of scripting began.

However, the fun with DCOP is not long. I learned Python after that and Python made me completely abandon my old friend. Python is too efficient, as I can reduce my scripts errors almost to zero.

Now, due to the challenge i face, the DCOP is coming again to help me (actually I did not have enough time to do research on doing this using Python).

The idea of the script is to get the video capture done from command line and be scheduled using cron/at. I am using dcop and kmplayer as the GUI for xine. Below is the steps I did to get the recording done:

  1. get kmplayer process ID
    $ dcop | grep kmplayer
    kmplayer-10963
  2. get the kxineplayer process ID
    $ dcop kmplayer-10963 kmplayer-mainwindow#1 getWinID
    14680071
  3. give the kmplayer the appropriate url
    $ dcop kmplayer-10963 KMediaPlayer openURL \ http://www.um.com.my/tv_channels/malaysia/rtm1.asx
  4. record it using kxineplayer
    $ kxineplayer -wid 14680071 -f ‘/home/fadli/.kde/share/apps/kmplayer/xine_config’ -vo xv,sdl,x11 -ao alsa -cb kmplayer-10963/KMPlayerCallback-0 -rec ‘/home/fadli/test.avi’

Sound easy, right? but the challenge is not over yet. What I have done is just to record the video. What I need is a program that are able to be scheduled. Em… well just put all the previous commands into a file. Add some chili sauces and ketchup. A little salt will make it more tasty. Also some sugar. 30 minutes baked in oven should be fine. Finally make the file executable using chmod. Now, it is ready to be served and yummy!

This is what I have in the script:

#!/bin/bash

# Definitions
src=http://www.um.com.my/tv_channels/malaysia/rtm1.asx
OUTPUT=/home/fadli/test.avi
TIME=30

# Getting IDs
PID=`dcop | grep kmplayer`
if [ -e $PID ] ; then
echo Starting KMPLAYER…
nohup kmplayer &
sleep 5
PID=`dcop | grep kmplayer`
else
echo KMPLAYER already started.
fi
WID=`dcop $PID kmplayer-mainwindow#1 getWinID`

# Process
dcop $PID KMediaPlayer openURL $SRC
sleep 5

echo killall kxineplayer | at now + $TIME minutes
kxineplayer -wid $WID -f ‘/home/fadli/.kde/share/apps/kmplayer/xine_config’ -vo xv,sdl,x11 -ao alsa -cb $PID/KMPlayerCallback-0 -rec $OUTPUT

And finally, put it up on schedule using cron or at.

Powered by ScribeFire.


Because I’m A Girl

11/08/2007

Artist: Kiss

Dodeche ar suga obso namjadurui maum
Wonhar ten onjego da juni ije tonande
Ironjog choumirago nonun thugbyorhadanun
Gu marur midosso negen hengbogiosso

Marur haji guresso nega shirhojyoda go
Nunchiga obnun nan nur bochegiman hesso
Norur yoghamyonsodo manhi guriurgoya
Sarangi jonbuin nanun yojainika

Modungor swibge da jumyon gumbang shirhjungnenunge
Namjara durosso thollin mar gathjin anha
Dashinun sogji anhuri maum mogo bojiman
Todashi sarange munojinunge yoja ya

Sarangur wihesoramyon modun da har su inun
Yojaui chaghan bonnungur iyong hajinun marajwo
Hanyojaro theona sarangbadgo sanunge
Irohge himdurgo oryourjur mollasso

Onur urin heojyosso
budi hengbogharago noboda johun sarammannagir barandago
Nodo darun namjarang togathe
nar saranghanda go marhanten onjego
Sorjighi na nega jar doenungo shirho
Naboda yepun yoja manna hengboghage jar sarmyon otohge
Nan irohge himdunde himduro juggenunde
Ajigdo nor nomu saranghanunde

Sarangur wihesoramyon modun da har su inun
Yojaui chaghan bonnungur iyong hajinun marajwo
Hanyojaro theona sarangbadgo sanunge
Irohge himdurgo oryourjur mollasso

english translation:

It’s impossible to understand what’s going through a guy’s heart ,
You told me that you wanted me and now that i’ve given you everything , you tell me you’re leaving…
You told me that it was the first time you felt this way, and said that i was special.
I believed you…and it was my happiness.

You should have told me that your feelings had faded.
I had no idea, and i continued to depend on you.
Although i say i hate you now, i’ll be missing you.
Because i’m a girl , to whom love is everything…

They say that when you give a guy all he wants he quickly gets bored,
and now i know that’s the truth…
and although i tell myself, i’ll never be tricked by love again…
i fall in love , and my heart is broken again…

please don’t break the hearts of girls, ho’ll do anything for love…
i didn’t know that living this life while being loved would be so hard.
although I say I hate you now, I’ll be missing you
because I’m a girl, to whom love is everything

today we broke up…
you tolds me to meet someone better than you, and be happy…
you’re just like all the other guys…
what happened to when you told me that you loved me???
honestly, i don’t want you to be happy…
what am i going to do if you really forget about me???
i’m in so much pain, more pain than i can bare…
because i’m still in love with you…

please don’t break the hearts of girls,who’ll do anything for love…
i didn’t know that living this life while being loved would be so hard.
although I say I hate you now, I’ll be missing you
because I’m a girl, to whom love is everything