-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.txt
executable file
·93 lines (61 loc) · 4.13 KB
/
setup.txt
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
================================================================================================
SQL COMMANDS FOR DATABASE
================================================================================================
CREATE TABLE cameras(cameraid serial primary key, name TEXT, url TEXT, latitude real,
longitude real, last_width int, last_height int, mhash text);
CREATE TABLE images(rowid serial primary key, filepath text,
curr_time timestamp, cameraid int, FOREIGN KEY(cameraid) references cameras(cameraid));
CREATE TABLE submit_cams(rowid serial, url text, description text, curr_time timestamp, latitude real,
longitude real);
================================================================================================
environment variables for amostest and local
================================================================================================
source env/bin/activate
SERVER
export DATABASE_URL="postgresql://krood20:password@localhost/krood20"
export DATABASE_URL="postgresql://suraj98:password@localhost/suraj98"
SURAJ
export DATABASE_URL=postgresql://suraj:password@localhost/amoseast
export DATABASE_URL=postgres:///amoseast
KYLE
export DATABASE_URL=postgres://kylerood:@localhost/kylerood
================================================================================================
Crontab set up to run python program for image downloading && log file
================================================================================================
sudo nano .bashrc
add to bashrc:
DATABASE_URL=postgresql://suraj98:password@localhost/suraj98
source ~/.bashrc and exit out of terminal
chmod a+x imagedownload.py
chmod a+x log.py
0 * * * * cd /pless_nfs/home/krood20/AMOSEast/flaskapp && /pless_nfs/home/krood20/AMOSEast/env/bin/python /pless_nfs/home/krood20/AMOSEast/flaskapp/imagedownload.py >> out.txt
0 5 * * * cd /pless_nfs/home/krood20/AMOSEast/flaskapp && /pless_nfs/home/krood20/AMOSEast/env/bin/python /pless_nfs/home/krood20/AMOSEast/flaskapp/log.py >> log.txt
================================================================================================
Command for copying cameras into the database
================================================================================================
psql -c "\copy images FROM '/home/suraj/Documents/GWU/AMOSEast/csv_data/cams_update.csv' delimiter ',' csv header"
psql -c "\copy images FROM '/pless_nfs/home/krood20/AMOSEast/csv_data/test.csv' delimiter ',' csv header"
psql -c "\copy cameras FROM '/Users/kylerood/AMOSEast/csv_data/data2.csv' delimiter ',' csv header"
================================================================================================
Command for exporting a table of the database to a csv
================================================================================================
COPY images TO '/pless_nfs/home/krood20/AMOSEast/csv_data/all_images.csv' DELIMITER ',' CSV HEADER;
\copy (SELECT * FROM images) to '/pless_nfs/home/krood20/AMOSEast/all_images.csv' with csv
================================================================================================
Command for running amostest.seas.gwu.edu
================================================================================================
To start the server: nohup php gunicorn app:app </dev/null &>/dev/null &
To kill the server: pkill -KILL -u username
================================================================================================
Watch command for running any command daily, hourly, etc.
================================================================================================
watch -n (time in seconds) (command you want to run)
For log file: watch -n 86400 python log.py
For image downloader: watch -n 3600 python imagedownload.py
================================================================================================
Command to copy over the images
================================================================================================
rsync -a ~/AMOSEast/flaskapp/static/images ~/AMOSEast/flaskapp/static/images5 --progress
python manage.py db init
python manage.py db migrate
python manage.py db upgrade