Articles Comments

{ Berbagi, Menulis, Dan Mengajar } Ilmu… » 7. Operating System » Setting Gammu Terbaru

Setting Gammu Terbaru

Setup Gammu SMS gateway pada Linux debian

#wget https://sourceforge.net/projects/gam…8.0/gammu-1.28.0.tar.gz
#tar xvfz gammu-1.28.0.tar.gz
#apt-get install autoconf
#apt-get install gcc
#apt-get install make
#apt-get install cmake
#apt-get install libxml2
#apt-get install libxml2-dev
#apt-get install libmysqlclient15-dev
#ls

akan terlihat folder gammu hasil extract, saat ini terlihat folder bernama gammu-1.28.0

# cd gammu-1.28.0
gammu-1.28.0#./configure
gammu-1.28.0#make
gammu-1.28.0#make install
gammu-1.28.0#cd docs/config
gammu-1.28.0/docs/config#cp gammurc smsdrc /etc/

# cd /var/log
/var/log#mkdir gammu
/var/log#cd gammu
/var/log/gammu#touch smsdlog
/var/log/gammu#ls -l

kalo hasilnya persis seperti berikut, berarti benar (tanggal & waktu tidak termasuk)
total 0
-rw-r–r– 1 root root 0 Dec 04 13:14 smsdlog

contoh, memakai GSM Modem Serial Wavecom Fastrack M1306 memakai Kartu Chip GSM men*ari tanpa security PIN CODE, tertancap di serial port 1
NB : Modem Wavecom Fastrack 1306 tidak bisa cek security status.

misal konfigurasi MySQL seperti berikut :
username : root
password : admin
database gammu : smsgw

# dmesg | grep tty

edit file gammurc, sbb :

# vi /etc/gammurc
[gammu]
port = /dev/ttyS0
connection = at115200

# vi /etc/smsdrc

[gammu]
port = /dev/ttyS0
connection = at115200

[smsd]
service = MYSQL
logfile = /var/log/gammu/smsdlog
commtimeout = 10
sendtimeout = 10
PIN = 1234
checksecurity = 0

pc = localhost
user = root
password = admin
database = smsgw

# mysql -u root -p
Enter Password : admin

mysql > CREATE DATABASE smsgw;
Query OK, 1 row affected (0.00 sec)

mysql > exit

lalu import lah SQL dump yang terdapat pada folder gammu-1.28.0/docs/sql/ sbb:

# mysql -u root -p smsgw <>

coba test gammu apakah berhasil terhubung pada modem

# gammu –identify

apabila terlihat beberapa data (sesuai merk modem anda)

Device : bla..bla..bla
Manufacturer : bla..bla..bla
Model : bla..bla..bla
Firmware : bla..bla..bla
IMEI : bla..bla..bla
SIM IMSI : bla..bla..bla

contoh :
Device : /dev/ttyS0
Manufacturer : Wavecom
Model : unknown (MULTIBAND 900E 1800)
Firmware : 641b09gg.Q2403A 1320676 061804 14:38
IMEI : 012345678901234
SIM IMSI : 510080035766529
lalu setelah semua sukses, jalankanlah daemon gammu seperti berikut

# gammu-smsd -c /etc/smsdrc

jika daemon berhasil berjalan akan tampil seperti berikut :

Log filename is “smsdlog”

untuk menghentikan proses di atas, anda tinggal tekan CTRL + C

klo ada error, agan bisa check di lognya, buat ngetrace error di mananya
#cat /var/log/gammu/smsdlog

tambahan buat jalankan gammu otomatis saat debian di hidupkan

# cp gammu-1.28.0/contrib/init/gammu-smsd.rh /etc/init.d/gammusmsd
#vi /etc/init.d/gammusmsd

bin=”/usr/local/bin/gammu-smsd”
configfile=”/etc/smsdrc”
pidfile=”/var/run/gammu.pid”

proc_name=`basename $0`
PID=`cat $pidfile`

function START_CMD {

$bin -c $configfile -p $pidfile -d
if [ “$?” != “0” ];then
echo “ERROR – gammu did not start!”
fi
}

function STATUS {
PID=`cat $pidfile`
if [ -n “$PID” ] ; then
echo “$proc_name running PID: $PID”
else
echo “$proc_name not running”
fi
}

# See how we were called.
case “$1″ in
start)
if [ -n “$PID” ]; then
if [ “`ps -p “$PID” -o comm=`” = “” ]; then
START_CMD
STATUS
else
echo “Error – $proc_name already running!”
STATUS
fi
else
START_CMD
STATUS
fi
;;
status)
STATUS
;;

stop)
if [ -n “$PID” ] ; then
echo “$proc_name stopping PID: $PID”
kill $PID
sleep 1
echo “” > $pidfile
echo “$proc_name stopped”
fi
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo $”Usage: $0 {start|stop|restart|reload|status}”
exit 1
esac

exit 0

nah sekarang buat test perintah menjalankan bisa pake comman berikut :
#/etc/init.d/gammusmsd start
ato
#/etc/init.d/gammusmsd restart
buat matikan
#/etc/init.d/gammusmsd stop

– TAMAT -

Filed under: 7. Operating System

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>