summaryrefslogtreecommitdiff
path: root/postrm-runit
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@gnu.org>2016-08-14 11:00:57 +0300
committerDmitry Bogatov <KAction@gnu.org>2016-08-14 11:00:57 +0300
commit57a8c6e20c63aaa3f6c328c4fb6a2a1a6d5a654b (patch)
tree5617737958c52d7277e76d5e06dd5b04a2701419 /postrm-runit
parentaa9698ddec92fd2dc5033ca24781a06894b96e60 (diff)
Clean-up supervision directory of log process too.
Diffstat (limited to 'postrm-runit')
-rw-r--r--postrm-runit40
1 files changed, 21 insertions, 19 deletions
diff --git a/postrm-runit b/postrm-runit
index cc19d38..9a69a53 100644
--- a/postrm-runit
+++ b/postrm-runit
@@ -1,28 +1,30 @@
1# -*- shell-script -*- 1# -*- shell-script -*-
2 2
3if [ "$1" = 'purge' ] ; then 3if [ "$1" = 'purge' ] ; then
4 # If runscript was never invoked, there will be no files 4 # If runscript was never invoked, there will be no files
5 # in this directory, and `dpkg' will remove it. In this case, 5 # in this directory, and `dpkg' will remove it. In this case,
6 # we have nothing to do. 6 # we have nothing to do.
7 supervise_dir="/var/lib/runit/supervise/#NAME#" 7 for supervise in "/var/lib/runit/supervise/#NAME#" \
8 if [ -d "$supervise_dir" ] ; then 8 "/var/lib/runit/log/supervise/#NAME#" ; do
9 if [ -d "$supervise" ] ; then
9 10
10 # Actually only `down' may be absent, but it does not 11 # Actually only `down' may be absent, but it does not
11 # matter. 12 # matter.
12 13
13 for file in control lock ok pid stat status down ; do 14 for file in control lock ok pid stat status down ; do
14 rm -f "$supervise_dir/$file" 15 rm -f "$supervise/$file"
15 done 16 done
16 17
17 # It should be empty now. If it is not, it means that system administrator put 18 # It should be empty now. If it is not, it means that
18 # something there. It is very stupid, but will of user is sacred, and directory 19 # system administrator put something there. It is very
19 # is left as-is in such case. 20 # stupid, but will of user is sacred, and directory is
20 # 21 # left as-is in such case.
21 # NOTE: Non-POSIX option is used. The day coreutils will no longer be essential, 22 #
22 # it will require a fix. 23 # NOTE: Non-POSIX option is used. The day coreutils will
23 rmdir --ignore-fail-on-non-empty "$supervise_dir" 24 # no longer be essential, it will require a fix.
24 fi 25 rmdir --ignore-fail-on-non-empty "$supervise"
25 unset supervise_dir 26 fi
27 done
26fi 28fi
27 29
28# Local Variables: 30# Local Variables: