22 June 2011

Linux Stuff

Steps to add VIP in linux

1. cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
2. nano /etc/sysconfig/network-scripts/ifcfg-eth0:0
3. Change DEVICE=eth0:0
IPADDR=new address
4. /etc/init.d/network restart

Steps to add swap file in linux

You need to use dd command to create swapfile. Next you need to use mkswap command to set up a Linux swap area on a device or in a file.

a) Login as the root user

b) Type following command to create 512MB swap file (1024 * 512MB = 524288 block size):
# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

c) Set up a Linux swap area:
# mkswap /swapfile1

d) Activate /swapfile1 swap space immediately:
# swapon /swapfile1

e) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:
# vi /etc/fstab

Append following line:
/swapfile1 swap swap defaults 0 0

So next time Linux comes up after reboot, it enables the new swap file for you automatically.

g) How do I verify swap is activated or not?
Simply use free command:
$ free -m


Find out OS version and whether it's running 32 bit / 64 bit on Solaris.


$ uname -a
SunOS madds6002 5.10 Generic_137111-08 sun4u sparc SUNW,Sun-Fire-V490
$ isalist
sparcv9+vis2 sparcv9+vis sparcv9 sparcv8plus+vis2 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
$

Delete non match pattern:

ls | grep -v *.zip | xargs -n1 -IREPLACE rm -rf REPLACE

Identify which process is writing to a log file:

lsof | grep path/to/log

No comments:

Post a Comment