Linux Server Light Weight GCM (Google Cloud Messaging for Android) Push notification Daemon.
Made by Simple ANSI-C language.
- Linux Server (I recommend AWS t1.micro for testing.)
- MySQL Server instance (version 5.x later.)
- Linux gcc, curl library (Linux general)
- MySQL Part
- Install MySQL Server and MySQL C Client library
# yum install mysql-server mysql-devel
- Run MySQL Server
# /etc/rc.d/init.d/mysqld start
- Setting MySQL root info
# /usr/bin/mysql_secure_installation
- The connection settings and create DB in MySQL console
mysql> CREATE CREATE DATABASE push_center;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON push_center.* to 'push'@'127.0.0.1' IDENTIFIED BY 'gcm' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
- Restore table using Schema file (Light_GCM_Linux_Push_Daemon/db_schema/table_schema.sql)
db_schema]# mysql -h 127.0.0.1 -u push -p push_center < table_schema.sql
- Modify mysql_connect.c file (Light_GCM_Linux_Push_Daemon/mysql_connect.c)
#include <mysql/mysql.h>
/**
* MySQL connect info define
*
* - MYSQL_HOST : Insert MySQL server ip address or domain address
* - MYSQL_PORT : Insert MySQL server port (ex 3306)
* - MYSQL_USER : Insert MySQL user ID to use for server connection
* - MYSQL_PASS : Insert MySQL user password to use for server connection
* - MYSQL_DB : Insert MySQL DB name to use for push service
*/
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_PORT 3306
#define MYSQL_USER "push"
#define MYSQL_PASS "gcm"
#define MYSQL_DB "push_center"
Ready Complete to Use Database.
- gcc, curl library install part
- Install gcc and curl-devel
# yum install gcc curl-devel
Ready to compile to Daemon end.
- Compile daemon
- find libmysqlclient.so path
# find / -name libmysqlclient.so
/usr/lib64/mysql/libmysqlclient.so
- compile Daemon
# gcc -o LLGCM_Push_Daemon LLGCM_Push_Daemon.c -lcurl -I/usr/include -L/usr/lib64/mysql/ -lmysqlclient -lm
drwxr-xr-x 2 root root 4096 Aug 4 05:42 db_schema
-rw-r--r-- 1 root root 5619 Aug 4 05:42 http_connect.c
-rwxr-xr-x 1 root root 23107 Aug 4 06:08 LLGCM_Push_Daemon
-rw-r--r-- 1 root root 4418 Aug 4 05:42 LLGCM_Push_Daemon.c
-rw-r--r-- 1 root root 2745 Aug 4 05:52 mysql_connect.c
-rw-r--r-- 1 root root 4932 Aug 4 05:42 push_util.c
-rw-r--r-- 1 root root 565 Aug 4 05:42 README.md
- execute Daemon
# LLGCM_Push_Daemon
- check Daemon
# ps aux | grep LLGCM
root 2417 18.7 0.2 161140 2088 ? Ss 06:08 0:00 ./LLGCM_Push_Daemon
root 11428 0.0 0.0 110280 844 pts/0 S+ 06:08 0:00 grep LLGCM_Push_Daemon
ver 0.0.1 (2014/08/04)
- first commit
Copyright (c) 2014 Lee Kyoung Il. See LICENSE.txt for details.