-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuninstall.sh
executable file
·77 lines (56 loc) · 2.09 KB
/
uninstall.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
#!/bin/bash
####
# Uninstalls housekeeping scripts
####
# @since 2021-05-21
# @author stev leibelt <[email protected]>
####
function _uninstall_mattermost_housekeeping ()
{
local PATH_OF_THE_CURRENT_SCRIPT_BASH=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)
#bin: executables, data: dynamic or static data files
local PATH_TO_BIN="${PATH_OF_THE_CURRENT_SCRIPT_BASH}/../bin"
local PATH_TO_DATA="${PATH_OF_THE_CURRENT_SCRIPT_BASH}/../data"
if [[ ! -f ${PATH_TO_DATA}/.is_installed ]];
then
echo ":: No Installation found."
echo " Please run >>${PATH_TO_BIN}/install.sh<< if needed."
return 1
fi
if [[ -f /usr/bin/systemctl ]];
then
systemctl -q is-active daily-mattermost-housekeeping.timer
if [[ $? -eq 0 ]];
then
sudo systemctl disable daily-mattermost-housekeeping.timer
fi
systemctl -q is-active hourly-mattermost-housekeeping.timer
if [[ $? -eq 0 ]];
then
sudo systemctl disable hourly-mattermost-housekeeping.timer
fi
systemctl -q is-active weekly-mattermost-housekeeping.timer
if [[ $? -eq 0 ]];
then
sudo systemctl disable weekly-mattermost-housekeeping.timer
fi
if [[ -f /etc/systemd/system/daily-mattermost-housekeeping.timer ]];
then
sudo rm /etc/systemd/system/daily-mattermost-housekeeping.timer
fi
if [[ -f /etc/systemd/system/hourly-mattermost-housekeeping.timer ]];
then
sudo rm /etc/systemd/system/hourly-mattermost-housekeeping.timer
fi
if [[ -f /etc/systemd/system/weekly-mattermost-housekeeping.timer ]];
then
sudo rm /etc/systemd/system/weekly-mattermost-housekeeping.timer
fi
sudo rm /etc/systemd/system/mattermost-housekeeping.service
rm ${PATH_TO_DATA}/mattermost-housekeeping.service
sudo systemctl daemon-reload
fi
mv ${PATH_TO_DATA}/local_config.sh ${PATH_TO_DATA}/local_config.sh.save
rm ${PATH_TO_DATA}/.is_installed
}
_uninstall_mattermost_housekeeping