Search

10/29/2014

User nc to send smtp message in centos

nc is a handy tool in unix to test network connection and we can use it
to write script to send smtp message as well. It is useful when we
implement some kind of server monitoring scripts and want to send out
alarm messages.

In the example below, we use 'nc' to connect smtp-server at port 25 to
send out contents in email-msg.txt

#nc smtp-server 25 < email-msg.txt

The email-msg.txt contains the below commands to form the smtp dialogue.

#cat email-msg.txt
HELO my-server
MAIL FROM:<sender@domain1.com>
RCPT TO:<receiver@domain2.com>
DATA
Subject:This is a sample subject
This is a sample mnessage body
.
QUIT

Note the last line of the message body is a line starting with '.'.

Another point to note is that if we create the email-msg.txt in unix
environment, we probably need to ensure each line ends by CRLF rather
than just a line feed.

To do so, we can simply use the unix2dos command:

#unix2dos email-msg.txt

10/11/2014

How to create a disk image of Elastix Mini UCS

To create DD Image file from  SD Card of MiniUCS:

Requirements
1.pc running linux
2.cf card reader

Steps to create dd image
1.connect the cf card reader to the linux pc
2.take out the CF card from elastix mini
3.insert the CF card inside the reader
4.in the linux pc, determine the device assigned to the cf reader using 'df -h'  (the device name is machine-dependent, eg /dev/sdc ,etc.)
5.create a disk image using dd command as below:
dd if=/dev/sdc  of= bs=32M

** pls check whether the sdcard is /dev/sdc


Restore DD Image from SD Card

1. dd if= of=/dev/sdc
2. Insert the new SD card into MiniUCS and boot it
3. Use computer to connect COM port of MiniUCS ( 115200 8N1, flow control=none )
4. login root/palosanto
5. Modity the file  /etc/sysconfig/network-scripts/ifcfg-eth0 to use dhcp
DEVICE=eth0
BOOTPROTO=dhcp
BROADCAST=
DHCPCLASS=
HWADDR=a0:98:05:01:be:9b
IPADDR=
NETMASK=
NETWORK=
ONBOOT=yes
TYPE=Ethernet
NOZEROCONF=yes


3. Finally, you need to restart the networking service, enter:
service network restart

4.  Determine the ip address by 'ifconfig'

5.  Login elastix by https:// with username/password = admin/palosanto.  Go to network and configure via the GUI.