Commserv

From Pcgmarket Development Playground

Jump to: navigation, search

Contents

What is Commserv?

Commserv is application to sending e-mails and sms using local smtp server and phone conected to computer. Messages are download from database.


Requirements

basic

  • Linux system,
  • Java Runtime Environment 6 or later,
  • database server MySQL in version 5.
  • essay

for sending e-mails

  • local server smtp.

for sending sms


Installing

Instalation is for debian system.

basic

jre instalation

  1. Download Java Runtime Environment from: http://java.sun.com/javase/downloads/index.jsp (name file: jre-<version>-linux-i586.bin).
  2. Copy downloaded file to /usr/java (create if don`t exists).
  3. Add executive privileges to file (chmod a+x jre-<version>-linux-i586.bin).
  4. Executive ./jre-<version>-linux-i586.bin and following by instalator.
  5. It should make catalog: /usr/java/jre<version>. Next you must add path <created dir>/bin to system variable PATH.
export PATH=$PATH:/usr/java/jre<version>/bin

Next add to file: /etc/profile before command export PATH following line:

PATH=$PATH:/usr/java/jre<version>/bin


comserv instalation

  1. Copy aplication (commserv.tar.bz2) to place where it will be run. (e.g. home directory).
  2. Unpacking (requires tar and bzip2):
  3. tar -xvf commserv.tar.bz2
    
  4. Create database, e.g.: mailing. If name of database is diferent then mailing, you must set up this name in _access.php file in pcgmarket
  5. Execute script in scheduler.sql (file is in main directory of aplication).

for sending emails

Postfix instalation

  1. apt-get install postfix
  2. Following by instalator and choose options consistent with your network.


for sending sms

connect your mobile to computer

gammu instalation

  1. apt-get install gammu
  2. Create file .gammurc in home directory (if not exist).
  3. Type configuration compile with connected mobile. For example:
[gammu]
port = /dev/ttyS0
model = 6310
connection = dlr3
synchronizetime = yes
use_locking = yes
gammuloc = locfile
gammucoding = utf8

We could detect model of phone by:

gammu --identify


To test our instalation you can execute following command:

echo "test" | /usr/bin/gammu -sendsms TEXT <phone number>


At the end you must add privileges to your port to which is connected the phone. You can do this by execute following command:

chmod 666 /dev/ttyS0


rest

screen program

  1. apt-get install screen

Configuration

Copy file scheduler.ini from main application directory to /etc/scheduler.ini.


available options

driver_db - driver to connect with database (usually com.mysql.jdbc.Driver).

server_db - database server address with user, password, encoding and database name:

jdbc\:mysql\://<server address>/<database name>?user\=<user>&password\=<password>&<encoding>

<server address> - IP address of database server,

<user> - database name user witch privileges to INSERT nad SELECT,

<password> - user password to database,

<encoding> - encoding using in database,

<database name> - database name.


email - switch on/off sending e-mails (available value: true, false).

email_threads - number of threads sending e-mails (available value: integers).

gsm - switch on/off sending sms (available value: true, false).

przykład pliku konfiguracyjnego

#Commserv configuration

#basic
driver_db=com.mysql.jdbc.Driver
server_db=jdbc\:mysql\://172.16.0.110/mailing?user\=mailing&password\=XXXXX&useUnicode\=false&characterEncoding\=latin2

#for email
email=true
email_threads=5

#for sms
gsm=true

Run

To run the application execute following command in main directory of commserv:

screen ./run.sh
Personal tools