Monday, March 30, 2009

the main command to see the file system status is df, that show the system's disk space usage (in kilobyte). if you want a more readable report in megabytes and gigabytes use the command df -h. it's useful to customize this command with the alias command.

if you need to know the size of a specified folder you can use the du command. it will show the size of every subfolder and as last value, the total size. if you only need this last information you can use the command du -hs

Diskcheck is a simple utility that monitors the amount of free disk space on the system and send email to the system administrator when one or more disk drives reach a specified capacity.You can download it from hereTo install it: as root rpm -ivh diskcheck-3.1.1-4.noarch.rpmThis utility is run as an hourly cron task, so you need the crond service running.You can customize this utility by editing /etc/diskcheck.conf file.

defaultCutoff — When disk drives reach this percent capacity, it will be reported. For example, if defaultCutoff = 90, an email will be sent when the monitored disk drives reach 90% capacity.

cutoff[/dev/partition] — Override the defaultCutoff for the partition. For example, if cutoff['/dev/hda3'] = 50 is specified, diskcheck will alert the system administrator when the partition /dev/hda3 reaches 50% capacity.

cutoff[/mountpoint] — Override the defaultCutoff for the mount point. For example, if cutoff['/home'] = 50 is specified, diskcheck will alert the system administrator when the mount point /home reaches 50% capacity.

exclude — Specify one or more partitions for diskcheck to ignore. For example, if exclude = "/dev/sda2 /dev/sda4" is specified, diskcheck will not alert the system administrator if /dev/sda2 or /dev/sda4 reaches the specified cutoff percentage.

ignore — Specify one or more file system types to ignore in the format -x filesystem-type. For example, if ignore = "-x nfs -x iso9660" is specified, the system administrator will not be alerted about nfs or iso9660 file systems reaching capacity.

mailTo — Email address of the system administrator to alert when partitions and mount points reach the specified capacity. For example, if mailTo = "webmaster@example.com" is specified, webmaster@example.com will be emailed alerts.

mailFrom — Specify the identity of the email sender. This is useful if the system administrator wants to filter the mail from diskcheck. For example, if mailFrom = "Disk Usage Monitor" is specified, email will be sent to the system administrator with the sender Disk Usage Monitor.

mailProg — Specify the mail program to use to send email alerts. For example, if mailProg = "/usr/sbin/sendmail" is specified, Sendmail will be used as the mail program.

Wednesday, March 25, 2009

crontab is a file which contains the schedule of cron entries to be run and at what times they are to be run.A cron schedule is a simple ASCII text file. Each user has their own cron schedule. You can edit it only with the crontab command. The default text editor is usually vi

30 8 * * * rm /home/{username}/temp/* >/dev/null 2>&1this is the same as the first example but with no email notification and no log file

30 8 * * * rm /home/{username}/temp/* > /home/{username}/logfiles/emptytemp.log >/dev/null 2>&1this is the same as the first example but with no email notification and the log file redirected to a custom location (> to replace the old log file with the new one, >> to append new log file to old one)

Tuesday, March 24, 2009

this is a useful simple tool to download files from rapidshare without visual tools. it's perfect if you want download files on your home pc from your office.you need a valid premium account on rapidshare and wget installed on your pc. to install it: as root yum install wget

create a new directory in your home directory (not as root!):cd /home/your_user_namemkdir .cookiessave a cookie in this folder with the following commands:wget \--save-cookies ~/.cookies/rapidshare \--post-data "login=USERNAME&password=PASSWORD" \-O - \https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi \/dev/null

Monday, March 23, 2009

If one of your hard disks is physically degrading, you can extend its lifetime (while you backup data and prepare to replace the disk) by marking bad blocks and preventing from attempting to store data on them. Assuming an unmounted, ext3 filesystem on /dev/sda1, you can use the following command to perform a non-destructive check for physical failures and then store them in a special inode that the operating system knows to avoid using:

~ e2fsck -cc /dev/sda1

You could also use the badblocks command by its self to write a list of bad blocks to a file and read it into e2fsck with the -l option later.

Friday, March 20, 2009

At the console of the ESXi host, press ALT-F1 to access the console windowEnter unsupported in the console and then press EnterEnter the password for the root loginEdit the file inetd.confUncomment the line that begins with #ssh and save the fileRun the command /sbin/services.sh restart

Error: “Could not power on VM: Admission check failed for memory resource”Go to Configuration system resource allocation > Click on advanced > Find the VIM object and change the reservation from 512 MB to 192 MB._________________________________________________________________________

Error: “Could not power on VM: Admission check failed for cpu resource”

On each virtual machines go to edit settings > Resources Tab. set CPU with a reservation of 0Mhz, and verify that Advanced CPU had Hyperthreaded Cored Shared Mode set to Any.

as root: first of all disable NetworkManager service and start network service, then create /etc/sysconfig/network-scripts/ifcfg-bond0 and add these lines:DEVICE=bond0BONDING_OPTS="mode=1 miimon=100 primary=eth0"BOOTPROTO=noneONBOOT=yesNETWORK=192.168.208.0NETMASK=255.255.255.0IPADDR=192.168.208.128

rdesktop is an open source command line client for Windows Terminal Services.
to install it in Fedora, as root: yum install rdesktop

RTKdesktop is a simple gui written in perl-Tk.
it need perl and perl-Tk. as root: yum install perl perl-Tk

here's the code:

#!/usr/bin/perl# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.use Tk;use File::Basename;use warnings;