Thursday, January 24, 2013

fvwm and network-manager

if you want to run fvwm with network-manger,

you can install stalone tray to run network-manager on fvwm,

#sudo apt-get install stalonetray

then from fvwm terminal run 

#stalonetray --dockapp-mode simple &


and for network-manger run

#nm-applet &

you will get network manager

Sunday, November 25, 2012

Chainloading Grub2 from Grub

add following entry into grub,


title grub2_os
root (hd0,0)
kernel /boot/grub/core.img
boot

replace root partition number for grub2 os on second line ex. partiton no 1 then second line should be
 root (hd0,1).

partition number start with so , if df command display partition as sda6 then number should be 5.

Thursday, November 15, 2012

java monitoring memory usage on server

If you want to see how memory used by java process using command line tools.
You can use jmap command on server.

First you need to get the process id using ps or jps command.

Then use following command, to see memory consumption by java process.

on 32 bit OS you need to use,

jmap -J-d32 -heap <process_id>

on 64 bit os you need to use,

jmap -J-d64 -heap <process_id>

Securing EC2 instance with Dynamic Ip

In order to secure ubuntu ec2 instance all port should be closed except port on which you running web server(http port 80, https port 443) on security group applied to ubuntu instance.

but some time you need to login into instance in order to do some maintenance, you need to open port ssh server.

If you have static ip from your connection provider, it is easy, you just need to add rule to open ssh port for that specific ip from aws console.

You can do the same thing with dynamic ip but every time your internet connection public ip change, you need to again add rule from aws console,

Or you can use following command to add your public ip to your security group (You need to have ec2-api-tools setup before using following command https://help.ubuntu.com/community/EC2StartersGuide),

ec2-authorize <security_group_name> -p 22 -s `w3m -dump http://www.monip.org/ | awk -F': ' '/IP/ { print $2 }' | sed -n 1p`/32

and if you need to specify aws region then,

ec2-authorize <security_group_name> --region <region_name> -p 22 -s `w3m -dump http://www.monip.org/ | awk -F': ' '/IP/ { print $2 }' | sed -n 1p`/32


when you are debugging something, looking at dmesg command output, you seen some problem with os in log, but don't know when it is happen because format of time is not easily readable then,

gist python script posted by some one https://gist.github.com/542780 can help you format dmesg output
If you are using ec2-api-tools on ubuntu and getting following error

Client.InvalidSecurity: Request has expired

Most probably your machine date and time is outdated
You need to update it using following command

sudo ntpdate ntp.ubuntu.com


Monday, October 10, 2011

ssh tunneling to access remote mysql on ec2

to acess remote mysql on ec2 as local on port 3307 using ssh tunneling we can use following command(assuming port is close on remote machine),

ssh -i -L 3307:localhost:3306 username@server

This command can be used to acces any other kind of service by changing port number