Install software:

opkg update
opkg install sqlite3-cli
sqlite3 /mnt/sda1/sensor.db
sqlite> CREATE TABLE sensor_data(
    id INTEGER PRIMARY KEY,
    temperature VARCHAR(64),
    sqlitetimestamp DATETIME DEFAULT CURRENT_TIMESTAMP
);
sqlite> INSERT INTO sensor_data (temperature) VALUES (30);
sqlite> INSERT INTO sensor_data (temperature) VALUES (40);
sqlite> select * from sensor_data;
sqlite>.quit
nano /mnt/sda1/sqlite3.sh
#!/bin/ash
sqlite3 /mnt/sda1/sensor.db<< EOF
INSERT INTO sensor_data (temperature) VALUES (50);
EOF
chmod 755 /mnt/sda1/sqlite3.sh
/mnt/sda1/sqlite3.sh

 

Comments powered by CComment