diff options
author | Dmitry Bogatov <KAction@gnu.org> | 2016-08-14 11:00:57 +0300 |
---|---|---|
committer | Dmitry Bogatov <KAction@gnu.org> | 2016-08-14 11:00:57 +0300 |
commit | 57a8c6e20c63aaa3f6c328c4fb6a2a1a6d5a654b (patch) | |
tree | 5617737958c52d7277e76d5e06dd5b04a2701419 | |
parent | aa9698ddec92fd2dc5033ca24781a06894b96e60 (diff) |
Clean-up supervision directory of log process too.
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | postrm-runit | 40 |
2 files changed, 22 insertions, 19 deletions
diff --git a/debian/changelog b/debian/changelog index ecbeb9c..29c6bea 100644 --- a/debian/changelog +++ b/debian/changelog | |||
@@ -7,6 +7,7 @@ dh-runit (1.5) UNRELEASED; urgency=medium | |||
7 | * Fix typo in mkdir option. | 7 | * Fix typo in mkdir option. |
8 | * Force shutdown of service we are uninstalling. Otherwise, it would be | 8 | * Force shutdown of service we are uninstalling. Otherwise, it would be |
9 | 5 seconds gap, when process are still alive. | 9 | 5 seconds gap, when process are still alive. |
10 | * Clean-up supervision directory of log process too. | ||
10 | 11 | ||
11 | -- Dmitry Bogatov <KAction@gnu.org> Sat, 13 Aug 2016 11:40:10 +0300 | 12 | -- Dmitry Bogatov <KAction@gnu.org> Sat, 13 Aug 2016 11:40:10 +0300 |
12 | 13 | ||
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 | ||
3 | if [ "$1" = 'purge' ] ; then | 3 | if [ "$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 | ||
26 | fi | 28 | fi |
27 | 29 | ||
28 | # Local Variables: | 30 | # Local Variables: |