How to set the Time / Date and Timezone in CentOS

UNIX / Linux - Redhat / Fedora

Sunday, 25 July 2010 21:27

In this article we will show you how to set the time, date and timezone within CentOS. Though im sure this method will remain the same through the various Linux distrobutions.

Steps

  1. Set the time zone
  2. Set the time and date
  3. Sync the hwclock with the current time and date

Commands

Below are the commands that are required. For the date command this will set the time and date to 25th July 22:17. The syntax is `date MMDDhhmmYYYY`.

rm /etc/localtime
ln -s /usr/share/zoneinfo/GMT /etc/localtime
date 072522172010
hwclock --systohc

Confirm Settings

To confirm your machine is set with the right time and date run the following commands :

[root@Fileserver ~]# date
Sun Jul 25 22:38:47 GMT 2010
[root@Fileserver ~]# hwclock
Sun 25 Jul 2010 10:38:51 PM GMT  -0.125883 seconds

 

How to install SSH on Solaris 10 x86

UNIX / Linux - Solaris

Wednesday, 14 July 2010 12:22

This guide will show you how to install SSH on Solaris 10 x86 from the Solaris installation DVD.

Mount CD
If you havent enabled the feature that will automatically mount your CDROM drive you will need to mount it using the following commands : 
mkdir /cdrom
Find the name of your cdrom
-bash-3.00# iostat -En
c0d0             Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Model: VMware Virtual  Revision:  Serial No: 000000000000000 Size: 16.11GB <16106065920 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0
c1t0d0           Soft Errors: 3 Hard Errors: 0 Transport Errors: 0
Vendor: NECVMWar Product: VMware IDE CDR10 Revision: 1.00 Serial No:
Size: 2.56GB <2563440640 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 3 Predictive Failure Analysis: 0
-bash-3.00# mount -F hsfs -o ro /dev/dsk/c1t0d0s0 /cdrom

Install the packages
-bash-3.00# cd /
-bash-3.00# pkgadd -d /cdrom/Solaris_10/Product/  SUNWsshcu SUNWsshdr SUNWsshdu SUNWsshr SUNWsshu

Enable SSH
-bash-3.00#svcadm enable ssh
-bash-3.00# svcadm restart ssh

Additonal Notes 

You will not be able to log in via SSH using root unless you amend the sshd_config file and set "allow root login" to yes.

 

ESX4 - How do I turn on/off a Virtual Machine from the command line ?

VMware - ESX

Monday, 12 July 2010 16:42

Using the vmware-cmd command you can perform a number of actions on your Virtual Machines from the command line.

Below shows you some of the functions you can perform :

List Virtual Machines

[root@ESX4 ~]# vmware-cmd -l
/vmfs/volumes/4c16a0ec-2c7ebe2a-6ad5-0011s8azz71c/OpenSolaris 2009.06/OpenSolaris 2009.06.vmx
/vmfs/volumes/4c16a0ec-2c7ebe2a-6ad5-0011s8azz71c/CentOS 5 - Oracle/CentOS 5 - Oracle.vmx
/vmfs/volumes/4c16a0ec-2c7ebe2a-6ad5-0011s8azz71c/CentOS 5a/CentOS 5a.vmx

Turn On Virtual Machine

Below shows you how to start a virtual machine, to stop it just change the start command for stop.
[root@ESX4 ~]# vmware-cmd "/vmfs/volumes/4c16a0ec-2c7ebe2a-6ad5-0011s8azz71c/OpenSolaris 2009.06/OpenSolaris 2009.06.vmx" start
start() = 1

List Virtual Machine Status`s

There maybe another (and easier) way of listing the virtual machine status`s if so please send it in.

vmware-cmd -l | sed '/^$/d' |  while read VMX ; do STATE=$(vmware-cmd  "${VMX}" getstate | awk ' { print $3 } ') ;  echo "${VMX}" = "${STATE}" ; done

 

How to create a CS-MARS Inspection Rule

General Info - General Info

Tuesday, 06 July 2010 20:20

Within CS-MARS there are 2 types of rules. Inspection Rules and Drop Rules. Inspection Rules allow you to trigger events based on certain triggers such as keywords, source, destination etc. Drop rule is an exception rule which MARS uses to ignore a behaviour that would otherwise trigger an event.

In this example we will configure a Inspection rule. First of all we need to define when this rule will trigger an event. For this example we will create an event every time someone saves an configuration change upon your Netscreen device. The syslog message for this is :

Jul  6 14:17:42 x.x.x.x ns200: NetScreen device_id=006403324004624  [Root]system-information-00767: System configuration saved by [user] via web from host x.x.x.x to x.x.x.x:443 by [user]. (2010-07-06 19:17:41)

Steps

1. Click Rules | Inspection Rules | Add

2. This will take you through a wizard. For each stage select Any. Until you get to the Keyword section.
3. Enter the text you want CS-MARS to trigger on.

 

4. Carry on through the wizard. At the end Apply the changes.

 

5. Now when you go into the Incident Rule section again you will see your new rule. By default your new rule will be activated.

Additional Notes 

Within the previous syslog message you will notice that the message ID is 00767. CS-MARS has a list of all the device message types/IDs which is calls event types. This is useful as this allows you to build rules based on event types rather then just using keyword strings.

 

Adaptec Storage Manager Script for ESX4

Programming - Bourne / BASH

Sunday, 27 June 2010 12:35

This article shows you how to script and alert (via email) for when any of your RAID disks show as offline or your Logical Drive is not showing as optimal.

In order to obtain all the stats about your Adaptec RAID card from your ESX box you can install the asm (adaptec storage manager) rpm which you can get from the adaptec website.

Once this is  installed you can then run a number of commands via the shell to query you RAID card.

  • Due to using a script and not using its java gui i removed the gui from the startup scripts via "chkconfig --del stor_agent"
  • Ensure you have ssmtp installed so that you can send emails via your command line.
  • You will now need to add this script to your cron job. CLICK HERE FOR SCRIPT. You will need to change the email variables.

Heres a sample of the html based email thats is generated ...

 

 

 

Page 2 of 50

«StartPrev12345678910NextEnd»

Article updates via email..


We have 19 guests online