-
Notifications
You must be signed in to change notification settings - Fork 10
/
install.sh
executable file
·44 lines (38 loc) · 1.22 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
dir=$(pwd)
stock-alarms -c > /dev/null
if [ $? -ne 0 ]; then
echo "Please install requirements.txt."
fi
# commands install to linux /usr/bin/
cd /usr/bin
sudo ln -sf ${dir}/scripts/stock-viewer.sh stock-viewer
sudo ln -sf ${dir}/scripts/stock-manager.sh stock-manager
sudo ln -sf ${dir}/stock-alarms.py stock-alarms
# SystemD installation
cd ${dir}
ServicesDir=$(pwd)/systemd
# Script with installation of all systemd scripts.
sudo ln -sfv ${ServicesDir}/*.sh /usr/bin/
sudo ln -sfv ${ServicesDir}/*.service /etc/systemd/system/
# Enable all timers
for file in ${ServicesDir}/*.timer; do
name=$(basename ${file})
sudo ln -sfv ${ServicesDir}/${name} /etc/systemd/system/
# If service exists then only copy
if [ -e /etc/systemd/system/${name} ]; then
echo "Exists. Updated ${name}!"
sudo systemctl enable $name
# if not started
sudo systemctl list-timers | grep ${name}
if [ $? -ne 0 ]; then
echo "Exists. Started also ${name}!"
sudo systemctl start $name
fi
#If not exists then start also
else
sudo systemctl enable $name
sudo systemctl start $name
fi
sudo systemctl status $name
done
sudo systemctl daemon-reload