> could you please apply this patch:
Thanks Ondrej. I'd already tried s.th. similar in the meantime, and, as
you presumed as well, this already ran into another race, causing mail
clutter.
So, how about a different approach and simply filter those messages:
I'd deem just appending "2>/dev/null" to that find command too crude, as
it would possibly hide other, "real" errors. So I diverted find's
STDERR, grep'ping -v just those "No such file or directory" messages and
(re-diverting to STDERR) let the rest pass.
Since the process substition I used is a bashism, the attached patch
also changes the shebang to bash.
Cheers
Daniel
--- /usr/lib/php5/sessionclean.orig
+++ /usr/lib/php5/sessionclean
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash -e
SAPIS="apache2:apache2\napache2filter:apache2\ncgi:php5\nfpm:php5-fpm\n"
@@ -22,7 +22,8 @@
done
# first find all open session files and touch them (hope it's not massive amount of files)
for pid in $(pidof $proc_names); do
- find "/proc/$pid/fd" -ignore_readdir_race -lname "$save_path/sess_\*" -exec touch -c {} \;
+ find "/proc/$pid/fd" -ignore_readdir_race -lname "$save_path/sess_\*" -exec touch -c {} \; \
+ 2> >(grep -v "^find: \`/proc/[0-9]\+/fd': No such file or directory$" >&2)
done
} ) | sort -rn -t: -k2,2 | sort -u -t: -k 1,1 | while IFS=: read -r save_path gc_maxlifetime; do
# find all files older then maxlifetime and delete them