Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 524698
Collapse All | Expand All

(-)a/app-admin/tmpwatch/files/tmpwatch.cron (-21 / +19 lines)
Lines 1-47 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
# vim: ft=sh
2
3
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
3
4
4
# This cron script contains several (commented out) examples.  You may use
5
# This cron script contains several (commented out) examples.  You may use
5
# them as is, by uncommenting them, or modify them to suit your needs.  Read
6
# them as is, by uncommenting them, or modify them to suit your needs.  Read
6
# tmpwatch(8) for more information on tmpwatch parameters.
7
# tmpwatch(8) for more information on tmpwatch parameters.
7
8
8
### Variables ###
9
10
TMPWATCH="/usr/sbin/tmpwatch"
11
#PORTAGE_TMPDIR="$(portageq envvar PORTAGE_TMPDIR)/portage"
12
#PORTAGE_LOGDIR="$(portageq envvar PORT_LOGDIR)"
13
#DISTDIR="$(portageq distdir)"
14
15
### EXAMPLES ###
9
### EXAMPLES ###
16
10
17
# NOTE: if you have noatime in /etc/fstab for any partitions you plan on
11
# NOTE: if you have noatime in /etc/fstab for any partitions you plan on
18
# running tmpwatch on, you should obviously change any of the examples that
12
# running tmpwatch on, you should obviously change any of the examples that
19
# use atime (-u|--atime).  Those that don't specify anything, default to 
13
# use atime (-u|--atime).  Those that don't specify anything, default to 
20
# atime.
14
# atime. Be aware that the time value is in HOURS!
21
22
# NOTE2: the time value is in HOURS!
23
15
24
# Delete everything in /tmp that haven't been accessed in a week (>=168 hrs).
16
# Delete everything in /tmp that haven't been accessed in a week (>=168 hrs).
25
#
17
#
26
# if [[ -d /tmp ]]; then
18
# if [ -d /tmp ]; then
27
#   ${TMPWATCH} --atime 168 /tmp
19
# 	tmpwatch --atime 168 /tmp
28
# fi
20
# fi
29
21
30
# Delete everything in PORTAGE_TMPDIR that hasn't been modified in 2 weeks.
22
# Delete everything in PORTAGE_TMPDIR that hasn't been modified in 2 weeks.
31
#
23
#
32
# if [[ -d ${PORTAGE_TMPDIR:-/var/tmp/portage} && -z $(/usr/bin/pgrep emerge) ]]; then
24
# if PORTAGE_TMPDIR=$(portageq envvar PORTAGE_TMPDIR) &&
33
#   ${TMPWATCH} --mtime --all 336 ${PORTAGE_TMPDIR:-/var/tmp/portage}
25
# 	[ -d "${PORTAGE_TMPDIR}/portage" ] &&
26
# 	! pgrep -x emerge >/dev/null
27
# then
28
# 	tmpwatch --mtime --all 336 "${PORTAGE_TMPDIR}/portage"
34
# fi
29
# fi
35
30
36
# Delete everything in DISTDIR that hasn't been accessed in 6 months (going
31
# Delete everything in DISTDIR that hasn't been accessed in 6 months (going
37
# by 30 day months)
32
# by 30 day months).
38
#
33
#
39
# if [[ -d ${DISTDIR:-/usr/portage/distfiles} ]]; then
34
# if DISTDIR=$(portageq distdir) && [ -d "${DISTDIR}" ]; then
40
#   ${TMPWATCH} --atime --fuser 4320 ${DISTDIR:-/usr/portage/distfiles}
35
# 	tmpwatch --atime --fuser 4320 "${DISTDIR}"
41
# fi
36
# fi
42
37
43
# Delete everything in PORTAGE_LOGDIR that hasn't been accessed in 4 weeks
38
# Delete everything in PORTAGE_LOGDIR that hasn't been accessed in 4 weeks.
44
#
39
#
45
# if [[ -d ${PORTAGE_LOGDIR:-/var/log/portage} ]]; then
40
# if { PORTAGE_LOGDIR=$(portageq envvar PORTAGE_LOGDIR) ||
46
#   ${TMPWATCH} --atime 772 ${PORTAGE_LOGDIR:-/var/log/portage}
41
# 	PORTAGE_LOGDIR=$(portageq envvar PORT_LOGDIR); } &&
42
# 	[ -d "${PORTAGE_LOGDIR}" ]
43
# then
44
# 	tmpwatch --atime 772 "${PORTAGE_LOGDIR}"
47
# fi
45
# fi

Return to bug 524698