|
|
@@ -73,7 +73,8 @@ apt-get -y install \ |
|
|
|
subversion \ |
|
|
|
dlocate \ |
|
|
|
ack-grep \ |
|
|
|
mutt |
|
|
|
mutt \ |
|
|
|
openssh-server |
|
|
|
|
|
|
|
# Set up timezone to America/New_York for the live CD |
|
|
|
echo America/New_York > /etc/timezone |
|
|
@@ -164,6 +165,22 @@ keep = 1y |
|
|
|
decimated = false |
|
|
|
EOF |
|
|
|
|
|
|
|
# Set up crontab |
|
|
|
cat > /home/nilmdb/crontab <<"EOF" |
|
|
|
SHELL=/bin/bash |
|
|
|
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
|
|
|
|
|
|
|
# Run capture and processing scripts every 5 minutes |
|
|
|
*/5 * * * * chronic /home/nilmdb/capture.sh |
|
|
|
*/5 * * * * chronic /home/nilmdb/process.sh |
|
|
|
|
|
|
|
# Try to run nilmdb-fsck on boot. It should hopefully run before |
|
|
|
# apache opens the database, and apache will return errors to clients |
|
|
|
# until nilmdb-fsck is done. |
|
|
|
@reboot chronic nilmdb-fsck --fix --no-data /home/nilmdb/db |
|
|
|
EOF |
|
|
|
crontab -u nilmdb /home/nilmdb/crontab |
|
|
|
|
|
|
|
# Fix permissions |
|
|
|
chown -R nilmdb:nilmdb /home/nilmdb |
|
|
|
chmod +x /home/nilmdb/{capture,process}.sh |
|
|
@@ -188,3 +205,18 @@ done |
|
|
|
|
|
|
|
# fix up all permissions in git dir, so nilmdb user can play with it later |
|
|
|
chown -R nilmdb:nilmdb /home/nilmdb/git |
|
|
|
|
|
|
|
# Create the initial database and streams by running the standalone |
|
|
|
# server as nilmdb, making the right nilmtool calls, and killing it. |
|
|
|
sudo -i -u nilmdb nilmdb-server -a 127.0.0.1 -p 18646 & |
|
|
|
SERVER=$! |
|
|
|
sleep 1 |
|
|
|
nilmtool -u http://127.0.0.1:18646/ destroy -R "/data/*" || true |
|
|
|
nilmtool -u http://127.0.0.1:18646/ create /data/raw uint16_6 |
|
|
|
nilmtool -u http://127.0.0.1:18646/ create /data/sinefit float32_3 |
|
|
|
nilmtool -u http://127.0.0.1:18646/ create /data/prep-a float32_8 |
|
|
|
nilmtool -u http://127.0.0.1:18646/ create /data/prep-b float32_8 |
|
|
|
nilmtool -u http://127.0.0.1:18646/ create /data/prep-c float32_8 |
|
|
|
kill $! |
|
|
|
sleep 1 |
|
|
|
kill -9 $! || true |