summaryrefslogtreecommitdiffstats
path: root/netdata.spec.in
diff options
context:
space:
mode:
authorJason Barnett <jason.w.barnett@gmail.com>2016-07-28 19:30:36 -0400
committerJason Barnett <jason.w.barnett@gmail.com>2016-07-28 19:30:36 -0400
commite46b07d8ac3e3a595052eff9ac59e1dc1299452c (patch)
tree7ec354e4212e969b211e9daed1471f39555a2396 /netdata.spec.in
parentee4de7bd2b88b824a40339477bdacb4e465e7afa (diff)
fix %post, %preun and %postun
Diffstat (limited to 'netdata.spec.in')
-rw-r--r--netdata.spec.in17
1 files changed, 15 insertions, 2 deletions
diff --git a/netdata.spec.in b/netdata.spec.in
index 884aa3fcdb..f2307f6f82 100644
--- a/netdata.spec.in
+++ b/netdata.spec.in
@@ -115,14 +115,27 @@ exit 0
%post
# Register the netdata service
/sbin/chkconfig --add netdata
-# Start the netdata service
-/sbin/service netdata start
+# Only gets run on initial install (not upgrades or uninstalls)
+if [ $1 = 1 ]; then
+ # Start the netdata service
+ /sbin/service netdata start
+fi
+exit 0
%preun
+# Only gets run on uninstall (not upgrades)
if [ $1 = 0 ]; then
/sbin/service netdata stop > /dev/null 2>&1
/sbin/chkconfig --del netdata
fi
+exit 0
+
+%postun
+# Only gets run on upgrade (not uninstalls)
+if [ $1 != 0 ]; then
+ /sbin/service netdata condrestart 2>&1 > /dev/null
+fi
+exit 0
%endif
%clean