26 |
# first check if mac is registered |
# first check if mac is registered |
27 |
serial=$(mysqldo "select serial from client_serials where mac='${mac_address}'") |
serial=$(mysqldo "select serial from client_serials where mac='${mac_address}'") |
28 |
|
|
29 |
|
# current mtime |
30 |
|
mtime=$(date +%s) |
31 |
|
|
32 |
if [[ -z ${serial} ]] |
if [[ -z ${serial} ]] |
33 |
then |
then |
|
mtime=$(date +%s) |
|
|
|
|
34 |
# request a new serial; one command now (cause must be done in the same session) |
# request a new serial; one command now (cause must be done in the same session) |
35 |
serial=$(mysqldo "insert into client_serials (mtime, mac) values('${mtime}','${mac_address}'); select last_insert_id();") |
serial=$(mysqldo "insert into client_serials (mtime, mac) values('${mtime}','${mac_address}'); select last_insert_id();") |
36 |
fi |
fi |