-
Notifications
You must be signed in to change notification settings - Fork 3
/
clean
executable file
·35 lines (35 loc) · 1.15 KB
/
clean
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
#!/bin/bash
set -e
set -x
echo '---[ Deleting the Backend samples folder and Analyzer analysis Folder ]---'
# Trailing slashes are mandatory .. http://unix.stackexchange.com/questions/37329/efficiently-delete-large-directory-containing-thousands-of-files
DIR_EMPTY='./empty/'
rm -rf "$DIR_EMPTY"
mkdir -p "$DIR_EMPTY"
# Second fastest way after perl: rsync
# perl only handles directories with no subdirectories..
# perl -e 'for(<*>){((stat)[9]<(unlink))}'
rsync -a --delete "$DIR_EMPTY" ./Backend/analyzer/samples/
rsync -a --delete "$DIR_EMPTY" ./StaticAnalysis/analysis/
rsync -a --delete "$DIR_EMPTY" ./DynamicAnalysis/analysis/
mkdir -p StaticAnalysis/analysis/ Backend/analyzer/samples/ DynamicAnalysis/analysis
echo '---[ Cleaning the Neo4J Database ]---'
(
DIR_NEO='/home/o/neo4j-community-3.0.4/'
cd "$DIR_NEO"
rm -rf ./data/databases/graph.db/
ulimit -n 40000
./bin/neo4j restart
)
echo '---[ Cleaning the Cuckoo Database ]---'
(
# TODO Stop neo4j Server, delete data/graph.db/* to remove old property nodes
cd DynamicAnalysis/cuckoo/
python cuckoo.py --clean
)
echo '---[ Cleaning the Postgesql Database ]---'
(
cd Backend
./cleandb
)
echo '---[ Done ]---'