Install & Configure OpenSSH

As I’m setting up a Linux CENT OS for an experimental project, I need to install and setup OpenSSH server into the Linux box, for secure and encrypted remote access instead of telnet and ftp.

To run an OpenSSH server, you must first make sure that you have the proper RPM packages installed. The openssh-server package is required and depends on the openssh package.

Firstly, I used yum to get the latest openssh packages.

# yum install openssh-server

Read more »

Popularity: 23% [?]

How To Configure yum To Get Through Proxy?

Yesterday, I was installing Linux Cent OS in Virtual Machine for an for an experimental project.

When using yum update to get all the latest packages, I realised that yum couldn’t successful updated. This is because office network is behid the squid proxy.

The steps to get yum operations to use a proxy server is really simple.

# The proxy server or IP address:port number
proxy=http://proxy.server.com:8080
# The proxy account for yum connections
proxy_username=userid
proxy_password=password

For more details, read Using yum with a Proxy Server

Popularity: 29% [?]

Confirm The Input

In many case, when developing a menu system using shell script, it will be good to prompt the user to confirm that it is okay to run a script.

for example:

Are you sure to run this task? [Yes | No]

Only reply with Yes will continue the action, else the script will exit or return to the menu.

This is useful when executing script that will perform critical tasks, such as rebooting server, stop/start application, purging files, and so on.

How to do that?

Read more »

Popularity: 16% [?]

fgrep files and insert characters before & after the output

I’m preparing a Unix shell script to scan backup log and to check for failure code.

If the directory backup is finished with failure, then the script must be able to pick-up the failed directory and write to an include file for re-submit later.

The backup log should have showing following result:

Backup processing of '/fscm/ldata/91/*' finished without failure.
Backup processing of '/fscm/ldata/92/*' finished without failure.
Backup processing of '/fscm/ldata/93/*' finished without failure.
Backup processing of '/fscm/ldata/94/*' finished without failure.
Backup processing of '/fscm/ldata/95/*' finished without failure.

What if some directories were failed to backup?

Backup processing of '/fscm/ldata/97/*' finished with failure.
Backup processing of '/fscm/ldata/98/*' finished with failure.

Read more »

Popularity: 19% [?]

Get Total No of Files and Total File Size in DVD/CD Media

Few months ago, I was preparing some statistics for data migration.

All data are stored in the DVD disc and I need to calculate total no of files and total data size capacity of each of the DVD disc.

There are more than 100 of discs.

I’m not keen to uses Windows Explorer to browse each media and copy down the info. This manual works is not productive.

The good part is all data are saved in same directory structure in the DVD disc.

For example:

\20060101\DATA\
\20060102\DATA\
\20060103\DATA\

So, I wrote this simple batch file.

Read more »

Popularity: 17% [?]

Next Page »