Helping forwarding the user tags' information to the server.
Using 3G communicate to the server.
Do NOT install any addiction package (space is limited)
apt-get install libdevice-serialport-perl
apt-get install expect
apt-get install wvdial
apt-get install rsync
apt-get install beep
apt-get install ntpdate
ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
vim /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
IDSN = 0
New PPPD = yes
Phone = *99#
Modem = /dev/ttyUSB1
Username = default
Password = default
Ask Password = 0
Dial Command = ATD
Stupid Mode = yes
vim /etc/udev/rules.d/taroko.rules
kerne;="ttyUSB*", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", SYMLINK="TAROKO"
vim /etc/udev/rules.d/battery.rules
KERNEL=="ttyUSB*", SYSFS{idVendor}=="067b", SYSFS{idProduct}=="2303", SYMLINK="BATTERY"
vim /etc/rc.local
/usr/bin/wvdialconf
/usr/bin/wvdial &
sh /root/BaseStation/run &
sh /root/BatteryMonitor/run &
sh /root/check.sh
exit 0
File structure
/root
|
|-- BaseStation
| |-- SerialForwarder.pl
| |-- run
| |-- send
| | `-- message
| `-- wildernessnet.sql
|-- BatteryMonitor
| |-- SerialBattery.pl
| `-- run
|-- check.sh
`-- cmdSender.sh
crontab -e
# m h dom mon dow command
* * * * * sh /root/cmdSender.sh "/sbin/ifconfig" "/root/BaseStation/send/message/" "network.log"
*/10 * * * * sh /root/cmdSender.sh "sh /root/check.sh" "/root/BaseStation/send/message/" "check.log"
ssh-keygen at StarBox (no passphrase)
copy the content of id_rsa.pub to the authorized_keys at the server
SerialForwarder.pl Receive the message from user's tag and forward to PC
SerialBattery.pl Communication with the battery
check.sh PC self-check procedure
cmdSender.sh Dump command inforamtion
All data that needed to send to the server will be placed under BaseStation/send directory.
Once the data is sent successfully, the data will be deleted.