-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb7_mysql.sh
More file actions
executable file
·28 lines (27 loc) · 852 Bytes
/
b7_mysql.sh
File metadata and controls
executable file
·28 lines (27 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
#
#####################################################
# b7_mysql.sh
#
# 29.8.2014
# Radek Nakoukal
#
# Script to send b7 log data to mysql database
# Script require - 3 parameter 1-rfid 2-time 3-number of control station
# if is less then 3 parameter then do nothing
#####################################################
dbHostName=$(/home/pi/b7/get_setting.sh dbserver)
dbPort=$(/home/pi/b7/get_setting.sh dbport)
dbName=$(/home/pi/b7/get_setting.sh dbname)
dbUserName=$(/home/pi/b7/get_setting.sh dbuser)
dbPasswd=$(/home/pi/b7/get_setting.sh dbpassword)
dbTableName=$(/home/pi/b7/get_setting.sh dbtablename)
if [ "$#" -eq 3 ]; then
rfid=$1
cas=$2
control=$3
mysql -h$dbHostName -P$dbPort -u$dbUserName -p$dbPasswd << EOF
use $dbName;
INSERT IGNORE INTO $dbTableName (RFID,CAS,KONTROLA) VALUES ('$rfid','$cas',$control);
EOF
fi