Friday, December 16, 2011

rsync vs scp

Remember not to try to rsync like scp, DO NOT SPECIFY PATH, instead look at the [] sections in rsyncd.conf called MODULES and use the below syntax

rsync * 192.168.1.1::MODULE_NAME

REMEMBER YOU ASS

Wednesday, November 30, 2011

usb dongle to vmware esx guest

use a network USB hub or a USB server software like kernelpro.com

Sunday, November 06, 2011

MS SQL Server update based on two tables

update r
set pass = x.pass
from InternetUser r inner join InternetUser x
on r.id = x.id
where r.pass = 'kjfkd9wjj2390eds9d';

Friday, November 04, 2011

simple socks server

simple socks server using ssh

ssh -f -N -D 0.0.0.0:1080 localhost

Wednesday, November 02, 2011

windows server domain policy

Simple thing took sooo much of my time
to change domain group policies that effect all domain machines change the Domain Security Policy under Administrative Tools not Local Group Policy by adding it under an mmc

Also to see which group policies are in effect in the domain look at gpresult /v >gposettings.txt

Tuesday, July 19, 2011

resize disk vmware vsphere


resize the disk from vsphere client,
in linux client do a

echo 1 > /sys/bus/scsi/devices/0\:0\:0\:0/rescan

# replace 0\:0\:0\:0 with your own disk scsi id and then

resize2fs /dev/sda

PS: In case a new disk was added to the SCSI bus you need to

echo "- - -" > /sys/class/scsi_host/host0/scan

Saturday, July 16, 2011

shrink vmware vmdk virtual disk ESXi 4

use vmware converter to create a copy of the virtual machine which needs to be powered ON for the converter to see the actual data, resize the disks also choose advanced thin for the disk type and have fun, remove the old machine later.

vmware converter helper server error

When vmware can not find the vmware helper server for conversion make sure that
1. conveter and esx server and the machine being converted are on the same lan (check the vlan property before converting)
2. the vlan on which the helper and these other machines are does have a DHCP server on, otherwise configure static IP for the helper

Tuesday, June 28, 2011

use listagg to convert columns into rows

SELECT id, LISTAGG(str, ',') WITHIN GROUP (ORDER BY str) AS name
FROM new_test
GROUP BY id;

gives you
1 a,b,c
2 d,e
3 f

from
1 a
1 b
1 c
2 d
2 e
3 f

Tuesday, June 21, 2011

previous not null values of a field in oracle

select lastprice, lag(lastprice ignore nulls,1) over (order by statdate) from daily_statistics

automount a specific directory with autofs

this is what we do
first umount your directory then mount the location you want to another directory and later create a symbolic link with the name you need

umount /usr/local/apache-tomcat-6.0.26/information-repository

rmdir /usr/local/apache-tomcat-6.0.26/information-repository

vi /etc/auto/master
/usr/local/mounts /etc/auto.nfs

vi /etc/auto.nfs
m_29 -fstype=nfs,rw 192.168.0.29:/u01/information-repository

mkdir /usr/local/mounts/m_29

ln -s /usr/local/mounts/m_29 /usr/local/apache-tomcat-6.0.26/information-repository

Friday, June 17, 2011

mount with UUID

get a blkid to find the UUID of the device you are after then in /etc/fstab do like this:
UUID=41c22818-fbad-4da6-8196-c816df0b7aa8 /disk1 ext3 defaults 0 0

Thursday, June 16, 2011

split the internet into 8 parts :)

1.0.0.0/255.0.0.0
2.0.0.0/254.0.0.0
4.0.0.0/252.0.0.0
8.0.0.0/248.0.0.0
16.0.0.0/240.0.0.0
32.0.0.0/224.0.0.0
64.0.0.0/192.0.0.0
128.0.0.0/128.0.0.0

Saturday, June 11, 2011

fortinet SSL VPN client automatic startup

download the client from here:
http://internal.enterprisecomponent.com/download/FortiClientSSLVPN/forticlientsslvpn_linux_4.0.2010.tar.gz

start the client and in advanced check save password and persistent connection

add the vpn client to the startup of a vnc server in ~/.vnc/xstartup

start the vncserver automatically by editing /etc/sysconfig/vncserver

and chkconifg vncserver on

Thursday, June 09, 2011

cacti add simple graph for a value from script

read this babe:
http://www.cacti.net/downloads/docs/html/how_to.html

cacti monitor link

1. add the ip address you want to monitor as a new device
2. Add the "Unix-Ping Latency" graph template to it.
3. Add a new graph of the above template to your device.

BIG thanks to: http://www.networknet.nl/apps/wp/archives/367

Monday, June 06, 2011

Linux add and load MIB

1. Copy the file the same place other MIB files are
2. add mibs +DEVICE_MIB to /etc/snmp/snmp.conf
3. snmpwalk -v2c -c public IP_ADDR enterprise

Sunday, May 29, 2011

linux force reboot or shutdown

Force Reboot :
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

If you want to force shutdown machine try this.
echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger

Thanks to http://linax.wordpress.com/2009/02/16/linux-force-reboot-and-shutdown/

Wednesday, May 25, 2011

linux create logical volume

pvcreate /dev/sdb1
vgcreate VolGroup01 /dev/sdb1
lvcreate -L953G -n LogVol00 VolGroup01
parted -l

add iscsi target and initiator in CentOS Linux

----------------- Target (Server) ----------------
#> vi /etc/tgt/targets.conf

<target iqn.2011-04.com.storage2.volgroup01.logvol00>
backing-store /dev/VolGroup01/LogVol00
</target>

#> service tgtd restart

; Take care of iptables

-----------Initiator (Client) -------------
#> iscsiadm -m discovery -t st -p 192.168.2.140
#> iscsiadm -m node
#> chkconfig iscsi on
#> service iscsi start


Sunday, May 22, 2011

linux discover and add new disk without reboot dynamically

To Discover and add new disk to a linux machine without having to reboot the server (e.g when virtual disk is added to a machine online) do the below:

ls /sys/class/scsi_host

#output is host0
#new rescan the scsi bus
echo "- - -" > /sys/class/scsi_host/host0/scan

#now you can see the new disk
fdisk -l

# add the new disk to the lvm if you want

Monday, May 16, 2011

vmware server 2 virtual console does not load

To solve the problem
find and run ./vmware-vmrc -h server:8333 -M "VM_ID"
to find "VM_ID" goto vmware webui and generate a shortcut on dekstop

Tuesday, May 10, 2011

ESXi scp

In ESXi to do scp using pscp simply do scp -scp to avoid doing sftp

Wednesday, May 04, 2011

Mikrotik DMZ

To put and IP address in DMZ
simple create a destination nat from the public IP to private without specifying anything else

Wednesday, April 20, 2011

get my oracle support (MOS) and metalink access cheap

Buy either
Oracle Load Testing Accelerator for Oracle E-Business Suite
Oracle Load Testing Accelerator for Siebel

Tuesday, April 19, 2011

linux bandwidth control

1. behind a router (easily done in mikrotik with queues)
2. using tc with iptables mangle
3. using redirection of traffic via squid proxy

Monday, February 28, 2011

MSM LSI MEGARAID

Install the latest MSM Megaraid manager regardless of whatever version actually belongs to the storage card on LSI website

Wednesday, January 19, 2011

Monday, January 10, 2011

openfiler scsi target not found in ESX 4.1

just edit /etc/initiators.deny and comment "ALL"

Sunday, January 09, 2011

resize LVM by adding new disk to lvm

    
fdisk /dev/sdb
mkfs -t ext3 -c /dev/sdb1
pvcreate /dev/sdb1
vgextend VolGroup00 /dev/sdb1
lvextend -L+1G /dev/VolGroup00/LogVol00 ;for adding one more GB to Logical Volume LogVol01
resize2fs /dev/VolGroup00/LogVol00


Thanks to http://sujithemmanuel.blogspot.com/2007/04/how-to-add-disk-to-lvm.html

amplify sound volume of a video file

To amplify - increase sound volume of - a video file do

ffmpeg -i myvideo.avi -vcodec copy -vol 5000 myvideo_louder.avi

thanks to http://superuser.com/questions/13552/how-to-amplify-the-audio-in-a-video-file

Thursday, January 06, 2011

VMWARE ESX 4.1 boot from ISO does not work

Remember to check the box which says "Connected", the damn thing took soooo much of my time.