29 Jul, 2008  |  Posted by dragoncity99  |  in HowTo, Linux

Most of the time, users are having a Windows Machine on their desk or laptop. Normally, we want to perform a full scale data retrieval from our Linux servers in the DC, where we don’t have a trusted Linux server to manage it….the answer to it is use “PLINK” utility.

Plink comes together with the Putty…

A simple example of usage is:

C:\> plink USERNAME@SERVERNAME ‘YOUR-LINUX-COMMAND’

If you have a dozen of servers…then you probably want to write a batch script in Windows to loop through a list of servers and mention the list of commands juz like what i did…..

Here a typical windows batch script:

@echo off

for / f “tokens=*” %%A in (your-server-list.txt) ( C:\path\to\plink.exe user@server -w YOUR-PASSWORD -m linuxcommandscript > YOUR_OUTPUT_FILE.txt)

There you go, i did this for my sar report data collection for root cause analysis and infrastructure load analysis….keying in a password wif every darn login is impractical and yet you dont want to generate a security key for the servers.

24 Jul, 2008  |  Posted by Danesh  |  in HowTo, Linux

Here’s a quick walk through to synchronize your system time through NTP.

Install the NTP package if you don’t already have it installed.

[root@abubu]# yum install ntp

Check your date.

[root@abubu]# date
Thu Jul 24 13:34:24 MYT 2008

Use the ntpdate command to poll from public NTP servers. I this example I’ll use ntp servers provided by the NTP POOL Project. The asia pool is “ntp asia.pool.ntp.org”

NTP POOL PROJECT

NTP POOL PROJECT

[root@abubu]# ntpdate asia.pool.ntp.org
24 Jul 16:02:18 ntpdate[5316]: step time server 202.144.207.222 offset -28647.175440 sec

Check your time again to make sure it’s correct.

[root@abubu]# date
Thu Jul 24 16:02:24 MYT 2008

I’ll cover the ntpd daemon in a future post.

18 Jul, 2008  |  Posted by Danesh  |  in HowTo, Linux

Here’s an easy way to get the pid of a running process.

Running the “pidof” command will return the pid(s) for a running program. See sample below,

danny@pandora:~> pidof syslog-ng
2043
danny@pandora:~> pidof acpid
2045
danny@pandora:~> pidof /usr/bin/firefox
14408
danny@pandora:~> pidof /usr/bin/compiz
27164
danny@pandora:~> pidof /bin/bash
27011 17339 16792 16477 15151 14403

Simple right!?

11 Jul, 2008  |  Posted by Danesh  |  in HowTo, Linux

Here’s a quick way to access your environment variables from the CLI.

User the “%” key in conjunction with your “<tab>” key to auto complete your environment variables.

pandora:/ # echo $J <TAB>
$JAVA_BINDIR  $JAVA_HOME    $JAVA_ROOT    $JDK_HOME     $JRE_HOME
pandora:/ # echo $JAVA_ <TAB>
$JAVA_BINDIR  $JAVA_HOME    $JAVA_ROOT
pandora:/ # echo $JAVA_HOME
/usr/lib/jvm/java

The traditional way is to “env | grep [variable name]