-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall
More file actions
executable file
·134 lines (99 loc) · 2.92 KB
/
uninstall
File metadata and controls
executable file
·134 lines (99 loc) · 2.92 KB
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
#
# Package: esync
# File: uninstall
# Summary: uninstall script for esyncd
# Maintainer: David Wicksell
# Last Modified: Sep 5, 2014
#
# Written by David Wicksell <[email protected]>
# Copyright © 2010-2014 Fourth Watch Software, LC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License (AGPL)
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
#
# This script is written to be run in a Red Hat environment
# Tweaks maybe needed for other distributions
#
# Do NOT set -e
#
if [ "${USER}" != "root" ]; then
echo "You must run this script as root."
exit 1
fi
echo "Uninstalling the esync package"
if [ -f "/usr/local/bin/esyncd" ]; then
rm /usr/local/bin/esyncd
echo ""
echo "Removed /usr/local/bin/esyncd"
fi
if [ -f /usr/local/share/man/man8/esyncd.8 ]; then
rm /usr/local/share/man/man8/esyncd.8
echo ""
echo "Removed /usr/local/share/man/man8/esyncd.8"
fi
if [ -f /etc/logrotate.d/esync ]; then
rm /etc/logrotate.d/esync
echo ""
echo "Removed /etc/logrotate.d/esync"
fi
if [ -f "/etc/init.d/esync" ]; then
files=`ls /etc/init.d/esync-*` # Need to grab all the links
for i in ${files}
do
script=`basename ${i}`
env=`echo ${script} | sed "s/.*-\(.*\)/\1/"` # Need the instance name
if [ -f /var/run/esyncd-${env}.pid ]; then
echo "Stopping the esync-${env} daemon"
/sbin/service esync-${env} stop
fi
/sbin/chkconfig --del esync-${env}
rm ${i}
echo ""
echo "Removed ${i}"
done
rm /etc/init.d/esync
echo ""
echo "Removed /etc/init.d/esync"
unset files script env
fi
# Check to see if syslog has a config for esync
if [ -f /etc/syslog.conf ]; then
grep -q 'esyncd.log' /etc/syslog.conf
test=$?
if [ ${test} = 0 ]; then
echo ""
echo "Removing esync config from /etc/syslog.conf"
# Need to remove the config out of the syslog.conf file
sed /esync/d /etc/syslog.conf >j.$$
sed '$ {/^$/d}' j.$$ >t.$$
rm j.$$
mv t.$$ /etc/syslog.conf
fi
unset test
if [ -f /var/run/syslogd.pid ]; then
echo ""
echo "Reloading the syslog configuration files"
/sbin/service syslog reload
else
echo ""
echo "Starting the syslog logging daemon"
/sbin/service syslog start
fi
if [ -f /var/log/esyncd.log ]; then
# Keep unfinished log file, but clean up the install
mv /var/log/esyncd.log /var/log/esyncd.log-`date "+%Y%m%d"`
echo ""
echo "Rotated current log to /var/log/esyncd.log-`date +"%Y%m%d"`"
fi
fi
echo ""
echo "uninstall-esync script has finished."
exit 0