-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
76 lines (53 loc) · 1.76 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
#!/bin/bash
if [ $# -lt 2 ]; then
echo 'You must supply slack channel name and webhook token as an arguments'
exit 1
fi
echo '[*] Installing dependencies'
echo '[*] Fetching slacktee GitHub repo'
git clone https://github.com/YouWeApS/slacktee.git
echo '[*] Installing slacktee.sh'
bash ./slacktee/install.sh /usr/bin
echo '[*] Removing fetched /slacktee folder'
rm -rf slacktee
echo '[*] Moving custom slacktee.conf to /etc'
script_dir=$( cd $(dirname $0); pwd -P )
conf_file="slacktee.conf"
conf_location="/etc"
sed -i "1i channel=$1" "$script_dir/$conf_file" # pasting the slack channel name to slacktee config
if [[ $? -ne 0 ]]; then
echo 'Failed to paste channel name to $conf_file'
exit 1
fi
sed -i "1i webhook_url=$2" "$script_dir/$conf_file" # pasting the webhook url to slacktee config
if [[ $? -ne 0 ]]; then
echo 'Failed to paste webhook url to $conf_file'
exit 1
fi
cp -i "$script_dir/$conf_file" $conf_location
if [[ $? -ne 0 ]]; then
echo 'Failed to copy $conf_file to $conf_location'
exit 1
fi
echo '[*] Installing service-health.sh'
install_path=/usr/bin
health_script="service-health.sh"
cp -i "$script_dir/$health_script" "$install_path"
if [[ $? -ne 0 ]]; then
echo 'Failed to copy $health_script to $install_path'
exit 1
fi
chmod +x "$install_path/$health_script"
echo '[*] :tada: service-health.sh installed'
echo '[*] Installing service-health-scheduler.sh'
scheduler_script="service-health-scheduler.sh"
cp -i "$script_dir/$scheduler_script" "$install_path"
if [[ $? -ne 0 ]]; then
echo 'Failed to copy $scheduler_script to $install_path'
exit 1
fi
chmod +x "$install_path/$scheduler_script"
echo '[*] :tada: service-health-scheduler.sh installed'
echo '[*] Removing service-health folder'
rm -rf service-health
echo '[*] Installation completed.'