forked from openenergymonitor/emonpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactoryreset
executable file
·41 lines (31 loc) · 1.17 KB
/
factoryreset
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
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
echo "Factory reset"
sudo service emonhub stop
sudo service emoncms-nodes-service stop
sudo service feedwriter stop
sudo service redis-server restart
echo "emoncms.conf reset"
cd /home/pi
> emoncms.conf
sudo mv /home/pi/emoncms.conf /home/pi/data/emoncms.conf
sudo chown pi:www-data /home/pi/data/emoncms.conf
sudo chmod 664 /home/pi/data/emoncms.conf
echo "emonhub.conf reset"
sudo cp /home/pi/emonhub/conf/emonhub.conf /home/pi/data/emonhub.conf
sudo chown pi:www-data /home/pi/data/emonhub.conf
sudo chmod 664 /home/pi/data/emonhub.conf
echo "deleting phpfina and phptimeseries data"
sudo rm -rf /home/pi/data/phpfina
sudo rm -rf /home/pi/data/phptimeseries
echo "creating new phpfina and phptimeseries folders"
sudo mkdir /home/pi/data/phpfina
sudo mkdir /home/pi/data/phptimeseries
sudo chown www-data:root /home/pi/data/phpfina
sudo chown www-data:root /home/pi/data/phptimeseries
echo "deleting mysql emoncms database"
mysql -u root -e "drop database emoncms" -praspberry
echo "creating new mysql emoncms database"
mysql -u root -e "create database emoncms" -praspberry
sudo service emonhub start
sudo service emoncms-nodes-service start
sudo service feedwriter start