Archive for the ‘Linux’ Category

How to rename a Redhat system.

Thursday, September 13th, 2012

Every once in awhile there is a need to rename a Redhat box.  Normally, I would prefer to reload them but there are times where the setup must be retained or the setup is relatively clean and reusable.

Renaming a Redhat box is easy.

1) vi /etc/sysconfig/network


2) change the entry for HOSTNAME= to the new hostname.


3) change the system names in /etc/hosts

There have been times where the hosts file remains unchanged.  Edit the file for the new names.

4) reboot the system and the new name should take effect.

Don’t forget to update DNS and NIS!


How to check physical RAM size with Redhat

Tuesday, September 11th, 2012

Company acquisitions always create “fun” when it comes to incorporating their usable equipment into the network.  The question of RAM will always get asked as small companies don’t always purchase large amounts of RAM for workstations and servers.

If you have a Redhat system and need to know the amount of physical ram, you can always look at meminfo.

Simply log into the system in question and enter : cat /proc/meminfo

The first two lines will answer your memory questions.

$ cat /proc/meminfo

 MemTotal:      16407060 kB
 MemFree:       12975592 kB
 Buffers:         228412 kB
 Cached:         2772496 kB
 SwapCached:           0 kB
 Active:         1248472 kB
 Inactive:       1927324 kB
 HighTotal:            0 kB
 HighFree:             0 kB
 LowTotal:      16407060 kB
 LowFree:       12975592 kB
 SwapTotal:      8385920 kB
 SwapFree:       8385920 kB
 Dirty:              236 kB
 Writeback:            0 kB
 Mapped:          203428 kB
 Slab:            221056 kB
 CommitLimit:   16589448 kB
 Committed_AS:    343556 kB
 PageTables:        7692 kB
 VmallocTotal: 536870911 kB
 VmallocUsed:     267100 kB
 VmallocChunk: 536603263 kB
 HugePages_Total:      0 kB
 HugePages_Free:       0 kB
 Hugepagesize:      2048 kB


Restart windows service from Linux

Monday, April 2nd, 2012

I had a request on how to restart the three LSF services from a script. The person worked on the farm team and did not relish the idea of using remote desktop or VNC.

I thought about a Powershell script or using a batch script to run the PsService from sysinternals. It looked simple as the command is as follows:

psservice \\<computer> -u <domain\username> -p password stop service <service name>

psservice \\<computer> -u <domain\username> -p password start service <service name>

I contacted the user and asked a couple more questions and learned she wanted to run the script from Linux. Of course this required a change in my approach as I like to keep things as simple as possible especially when a user will write their own script. I decided to abandon windows scripts and find away to see if Linux could handle this via the windows management interface.

Looking around the Net, I found a way I didn’t even consider. Simply install the Samba-Common. This offers the Net utility(or as close to it as possible) for the Linux host. The particular command in question is Net RPC service command:

To list out the services on a Windows computer:

net rpc service list -I <IP Address> -U “<domain\username>%<password>”

If you wish to use the command line; simply remove “%<password>” and you will be prompted for a password.

To start or stop a service; you would enter:

net rpc service {start|stop} <Service Name> -I <IP Address> -U “<domain\username>%<password>”

Again, if you wish to use the command line, simply remove “%<password>” and you will be prompted for a password.

The account used will have to have local admin privileges so if you decide to script it, secure the file to yourself since the password will be plain text.

Much as I would like to impress you with my great knowledge; there was a sense of urgency to the request so I went to the Net and I did get help from the following sites so credit must be given where credit is due.