Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, September 5, 2012

Tuesday, June 26, 2012

rsync - Syncing soft-link's as soft-link

We were running rsync between 2 repositories (created on Linux OS) from many days. But we missed to handle soft-links properly. The option 'l' provided by rsync will update the soft-links in the destination server accordingly. If this option is not provided, in the destination, the directory pointed by source will be created with the soft-link name and it will be never updated at all !


Here is a usage of rsync
/usr/bin/rsync -avuzl --stats /export/kits/dpm/builds/dev/rkm root@us-repo.org:/export/kits/dpm/builds/dev


Where the options
 -a, --archive               archive mode;
 -v, --verbose               increase verbosity
 -u, --update                skip files that are newer on the receiver
 -z, --compress              compress file data during the transfer
 -l, --links                 copy symlinks as symlinks

Tuesday, April 17, 2012

Using wget to download files recursively from https site

wget is a command used mostly in Linux to download files from web links (http, https or ftp). To download a file, a simple invocation of wget like
  wget http://mylibrary.com/build-kits/rel-2.7.1/prod1/prod1-2.7.1.10.tar
will download prod1-2.7.1.10.tar to the current directory.

To download set of files (ex .tar files) from a secured https site, we need to provide several options to it
  wget --no-check-certificate -r -l1 --no-parent -A.tar http://mylibrary.com/build-kits/rel-2.7.1/prod1/
where
  --no-check-certificatedon't validate the server's certificate
  -r or --recursive: specify recursive download
  -l1 or --level=NUMBER: maximum recursion depth (inf or 0 for infinite).
 --no-parentdon't ascend to the parent directory
 -A or --accept=LIST:  comma-separated list of accepted extensions.
 -nd or --no-directories: don't create directories.

Monday, February 15, 2010

Linux system logs management using logrotate

You can rotate log file using logrotate software and monitor logs files using logwatch software.

Working on it, will update soon


How to truncate all the log files under /var/log? (I don't want to delete them)
bash# for x in `ls -l /var/log|grep "^-r"|awk '{print $9}'`; do >$x; done

Wednesday, October 14, 2009

How to access CD from LINUX installed in VMWare Virtual machine?

In VMware workstation click on VM -> Settings -> CD-ROM.
Make sure check boxes "Connected" and "Connect at power on" are ticked.
Then restart the Linux machine availble in VM.

After this you need to mount CDROM to one of your local location.
Find out in your machine where CDROM device is available.
>>> dmesg|grep -i cdrom
hdc: Vmware Virtual IDE CDROM Drive, ATAPI CD/DVD-ROM drive

From above output, in my machine it is available in /dev/hdc.

Now mount it to a local location "/mnt/cdrom". Make sure this directory is already created.

>>> mount /dev/hdc /mnt/cdrom
mount: block device /dev/hdc is write-protected, mounting read-only

Thats it. Now you can access the CD contents from /mnt/cdrom.

Thursday, December 4, 2008

How to know a Unix/Linux system is a 32/64 bit architecture?

To know whether given Unix/Linux machine is of type 32/64 bit architecure, use the command

getconf LONG_BIT

It outputs correspondingly 32 or 64 bit.

For AIX machine use "bootinfo -K" command for same purpose

Reference: http://www.unixguide.net/unixguide.shtml