Commserv
From Pcgmarket Development Playground
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
- mobile cooperate with gammu (list supported phones: http://www.gammu.org/support/phones/phonedb.php) connected with computer,
- gammu program in version 1.20 or later.
Installing
Instalation is for debian system.
basic
jre instalation
- Download Java Runtime Environment from: http://java.sun.com/javase/downloads/index.jsp (name file: jre-<version>-linux-i586.bin).
- Copy downloaded file to /usr/java (create if don`t exists).
- Add executive privileges to file (chmod a+x jre-<version>-linux-i586.bin).
- Executive ./jre-<version>-linux-i586.bin and following by instalator.
- 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
- Copy aplication (commserv.tar.bz2) to place where it will be run. (e.g. home directory).
- Unpacking (requires tar and bzip2):
- 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
- Execute script in scheduler.sql (file is in main directory of aplication).
tar -xvf commserv.tar.bz2
for sending emails
Postfix instalation
- apt-get install postfix
- Following by instalator and choose options consistent with your network.
for sending sms
connect your mobile to computer
gammu instalation
- apt-get install gammu
- Create file .gammurc in home directory (if not exist).
- 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
- 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

