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
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
|
Details
the cron job says
#!/bin/sh # exit without error if no pidfile exists { read pid </run/squid.pid; } 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 fi 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 fi to /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
Wednesday, 29 August 2012, 12:50 GMT
Reason for closing: Won't fix
Additional comments about closing: squid is now in AUR
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
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.
- 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 {
daily
compress
delaycompress
rotate 2
missingok
nocreate
sharedscripts
postrotate
test ! -e /run/squid.pid || /usr/sbin/squid -k rotate
endscript
}