This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
forked from pothiers/tada
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·141 lines (122 loc) · 3.56 KB
/
install.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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
# This for use under DEVELOPMENT (NATICA system).
# Run this after code modifications. Installs TADA python stuff from source.
# Run as sudo (typically under vagrant as vagrant user, no venv active).
# Usually has to be run on both Mountain and Valley hosts.
#
# SEE ALSO:
# /opt/tada/scripts/tada-valley-install.sh
# (which is used to provision under Puppet)
# sudo /sandbox/tada/scripts/updateTadaTables.sh
# SIMILARLY: /opt/data-queue/scripts/dataq-valley-install.sh
#
# EXAMPLES:
# sudo /sandbox/tadanat/install.sh
# sudo install.sh -c # clean first
#
SCRIPT=$(readlink -f $0) # Absolute path to this script
SCRIPTPATH=$(dirname $SCRIPT) # Absolute path this script is in
usage="USAGE: $cmd [options] [repoDirectiory]
OPTIONS:
-c:: Clean before install. (/var/tada, queue)
-v <verbosity>:: higher number for more output (default=0)
"
VERBOSE=0
PROGRESS=0
CLEAN="NO"
while getopts "hcv:" opt; do
case $opt in
c)
CLEAN="YES"
;;
h)
echo "$usage"
exit 1
;;
v)
VERBOSE=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
#echo "OPTIND=$OPTIND"
for (( x=1; x<$OPTIND; x++ )); do shift; done
RAC=0 # Required Argument Count
if [ $# -lt $RAC ]; then
echo "Not enough non-option arguments. Expect at least $RAC."
echo >&2 "$usage"
exit 2
fi
repodir=${1:-/sandbox}
installprefix=/opt/tada/venv
echo "Installing (natica) FROM repo: $repodir to $installprefix"
##############################################################################
#!if [ "$CLEAN" = "YES" ]; then
#! sudo rm -rf /var/tada/*/*
#! find /var/tada
#! dqcli --clear -s
#!fi
source /opt/tada/venv/bin/activate
##################################################
### Force install of python packages from source
###
echo "#######################################################"
echo "WARNING: NOT rebuilding dataq software!!! in install.sh"
echo "#######################################################"
#!echo "Install: dataq.."
#!pushd $repodir/dataq > /dev/null
#!pylint -E dataq/
#!python3 setup.py install --force --prefix $installprefix
#!popd > /dev/null
###
#!echo
#!echo "WARNING: NOT rebuilding tada software!!! (in install.sh)"
#!echo
echo "Install: tada.."
pushd $repodir/tadanat > /dev/null
pylint -E tada/
pylintstatus=$?
if [ $pylintstatus -eq 1 ]; then
echo "pylint FATAL message for TADA"
exit 1
fi
if [ $pylintstatus -eq 2 ]; then
echo "pylint ERROR message for TADA"
exit 2
fi
python3 setup.py install --force --prefix $installprefix
popd > /dev/null
###
##########################################################
sudo rm /var/log/tada/*.err
sudo service dqd restart > /dev/null
if [ -s /var/log/tada/dqd.err ]; then
cat /var/log/tada/dqd.err
echo "ERROR: The 'dqd' service is not running"
exit 1
else
echo "dqd restarted successfully."
#!sudo dqcli --clear
dqcli --clear
fi
sudo service watchpushd restart > /dev/null
if [ -s /var/log/tada/watchpushd.err ]; then
cat /var/log/tada/watchpushd.err
echo "ERROR: The 'watchpushd' service is not running"
exit 1
else
echo "watchpushd restarted successfully"
fi
sudo chown tada.tada /var/log/tada/dqcli*.log
sudo chmod 777 /var/log/tada/dqcli*.log
echo "Clear logs /var/log/tada/*"
truncate -s 0 /var/log/tada/*
echo "### INSTALLED: `date`"
echo "############################################################"