Bug#629609: cyrus-imapd-2.4: proc and lock directories should be cleaned and put on tmpfs
Steven Kurylo
steven.kurylo at aviawest.com
Wed Jun 8 02:25:50 UTC 2011
Package: cyrus-imapd-2.4
Version: 2.4.9~beta1-1
Severity: normal
Tags: patch
Per the documentation for 2.4, the locks should be cleaned out. I think cleaning out proc
at the same time would be a good idea, in case a file is left after a crash.
As well in the init script I:
* Silenced try-restart
* Improved SYNCSHUTDOWN check
They should both be on tmpfs for better performance too. So I've changed the
default config file to /run/cyrus/
Thank you for considering my patches.
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.38-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages cyrus-imapd-2.4 depends on:
ii cyrus-c 2.4.9~beta1-1 Cyrus mail system - common files
ii libc6 2.13-5 Embedded GNU C Library: Shared lib
ii libcome 1.41.12-4 common error description library
ii libdb5. 5.1.25-10 Berkeley v5.1 Database Libraries [
ii libsasl 2.1.24~rc1.dfsg1+cvs2011-05-23-3 Cyrus SASL - authentication abstra
ii libssl1 1.0.0d-2 SSL shared libraries
ii libwrap 7.6.q-19 Wietse Venema's TCP wrappers libra
ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime
cyrus-imapd-2.4 recommends no packages.
cyrus-imapd-2.4 suggests no packages.
-- no debconf information
-------------- next part --------------
--- imapd.conf 2011-06-07 19:15:00.523999297 -0700
+++ imapd.conf-new 2011-06-07 19:20:46.251998286 -0700
@@ -4,6 +4,10 @@
# Configuration directory
configdirectory: /var/lib/cyrus
+# Directories for proc and lock files
+proc_path: /run/cyrus/proc
+mboxname_lockpath: /run/cyrus/lock
+
# Which partition to use for default mailboxes
defaultpartition: default
partition-default: /var/spool/cyrus/mail
-------------- next part --------------
--- cyrus-common.cyrus-imapd.init 2011-06-07 19:05:14.155998569 -0700
+++ cyrus-common.cyrus-imapd.init-new 2011-06-07 19:24:30.451999607 -0700
@@ -34,9 +34,6 @@
PIDFILE="/var/run/${NAME}.pid"
DESC="Cyrus IMAPd"
-SYNC_CLIENT=/usr/lib/cyrus/bin/sync_client
-SYNCSHUTDOWN="$([ -r /etc/imapd.conf ] && (grep sync_shutdown_file /etc/imapd.conf|awk '{print $2}'))"
-
# Check if Cyrus is installed (vs. removed but not purged)
test -x "$DAEMON" || exit 0
@@ -56,6 +53,20 @@
[ "x${MASTERCONF}" != "x" ] && OPTIONS="-M ${MASTERCONF} ${OPTIONS}"
[ "x${LISTENQUEUE}" != "x" ] && OPTIONS="-l ${LISTENQUEUE} ${OPTIONS}"
+if [ -n "$CONF" ]; then
+ [ -r "$CONF" ] || ( echo Could not read config file $CONF; exit 1)
+else
+ CONF=/etc/imapd.conf
+fi
+
+SYNC_CLIENT=/usr/lib/cyrus/bin/sync_client
+SYNCSHUTDOWN="$(gawk '/^sync_shutdown_file:[[:blank:]]/ { print $2 }' $CONF)"
+CONFIGDIR="$(gawk '/^configdirectory:[[:blank:]]/ {print $2}' $CONF)"
+LOCK_DIR="$(gawk '/^mboxname_lockpath:[[:blank:]]/ {print $2}' $CONF)"
+PROC_DIR="$(gawk '/^proc_path:[[:blank:]]/ {print $2}' $CONF)"
+[ -z "$LOCK_DIR" ] && LOCK_DIR="$CONFIGDIR/lock"
+[ -z "$PROC_DIR" ] && PROC_DIR="$CONFIGDIR/proc"
+
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
@@ -132,6 +143,11 @@
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
+
+ # Clean stale entries
+ find "$LOCK_DIR" -mindepth 1 -depth -size 0 # -delete
+ find "$PROC_DIR" -mindepth 1 -depth -name '[0-9]*' # -delete
+
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
@@ -262,7 +278,7 @@
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
try-restart)
- pidofproc "$DAEMON" && exec $0 restart
+ pidofproc "$DAEMON" >/dev/null && exec $0 restart
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|try-restart}" 1>&2
More information about the Pkg-Cyrus-imapd-Debian-devel
mailing list