Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#30991 - [squid] logs never get rotated

Attached to Project: Arch Linux
Opened by Hussam Al-Tayeb (hussam) - Friday, 03 August 2012, 11:03 GMT
Last edited by Eric Belanger (Snowman) - Wednesday, 29 August 2012, 12:50 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


the cron job says


# exit without error if no pidfile exists
{ read pid </run/; } 2>/dev/null || exit 0

# make sure found PID really is a squid process
if [ /proc/$pid/exec -ef /usr/sbin/squid ]; then
/usr/sbin/squid -k rotate

There is something wrong with the second condition.
first of all, let's say the pid is 4585.
/proc/4584/exec doesn't exit. there is a /proc/4584/exe

and if I changed:
if [ /proc/$pid/exec -ef /usr/sbin/squid ]; then
/usr/sbin/squid -k rotate


/usr/sbin/squid -k rotate

the files get rotated correctly.
This task depends upon

Closed by  Eric Belanger (Snowman)
Wednesday, 29 August 2012, 12:50 GMT
Reason for closing:  Won't fix
Additional comments about closing:  squid is now in AUR
Comment by Jelle van der Waa (jelly) - Wednesday, 08 August 2012, 18:35 GMT Please test this version it should work.
Comment by Hussam Al-Tayeb (hussam) - Wednesday, 08 August 2012, 20:03 GMT
it doesn't. there is no /proc/$pid/state/exe

dir /proc/25782/
attr coredump_filter io mountstats personality stat
autogroup cpuset limits net root statm
auxv cwd loginuid ns sched status
cgroup environ maps oom_adj schedstat syscall
clear_refs exe mem oom_score sessionid task
cmdline fd mountinfo oom_score_adj smaps wchan
comm fdinfo mounts pagemap stack
Comment by Jelle van der Waa (jelly) - Wednesday, 08 August 2012, 22:16 GMT
Yup reading the wrong PID

root 19739 0.0 0.0 43872 1728 ? Ss 00:14 0:00 squid -sYC
proxy 19741 0.1 0.0 46688 7864 ? S 00:14 0:00 (squid) -sYC

I am not sure if the extra sanity check is worth it. maybe just check if /proc/$pid exists and then rotate the logs.
Comment by Jan de Groot (JGC) - Saturday, 25 August 2012, 11:19 GMT
I would suggest taking a different approach:
- set logfile_rotate 0 in configuration
- get rid of cronjob for logrotates
- dump a logrotate file in /etc/logrotate.d:

# Logrotate fragment for squid.
/var/log/squid/*.log {
rotate 2
test ! -e /run/ || /usr/sbin/squid -k rotate