-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup_setup.sh
executable file
·47 lines (39 loc) · 1.35 KB
/
cleanup_setup.sh
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
#!/usr/bin/env bash
cleanup_function () {
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export PYTHONPATH=$PYTHONPATH:$DIR
if [ `whoami` != "root" ]; then
echo "must run as root, try \"sudo su\" and re-run"
exit -1
fi
#log file
path_to_log_file=$DIR/logs/$1
source $DIR/.pockit/bin/activate
echo
echo "************************************"
echo "Cleanup the complete installation"
echo "===================================="
echo
echo "This may take a while..............."
echo
echo "************************************"
python -u $DIR/post_deployment/sk_cleanup.py
if [ $? -eq 1 ]; then
echo
echo "====================================================="
echo "cleanup environment encountered errors"
echo "please check log file at $path_to_log_file for errors"
echo "====================================================="
exit 1
else
echo
echo "*******************************************************"
echo "cleanup environment is done"
echo "*******************************************************"
echo
exit 0
fi
}
log_file_name="cleanup_log"
new_log_file="$log_file_name-$(date "+%Y_%m_%d_%H_%M_%S").txt"
cleanup_function $new_log_file 2>&1 | tee -a logs/$new_log_file