[88826] users/ryandesign/scripts/housekeeping

ryandesign at macports.org ryandesign at macports.org
Thu Jan 12 18:18:15 PST 2012


Revision: 88826
          http://trac.macports.org/changeset/88826
Author:   ryandesign at macports.org
Date:     2012-01-12 18:18:15 -0800 (Thu, 12 Jan 2012)
Log Message:
-----------
housekeeping: script to perform periodic MacPorts maintenance

Added Paths:
-----------
    users/ryandesign/scripts/housekeeping

Added: users/ryandesign/scripts/housekeeping
===================================================================
--- users/ryandesign/scripts/housekeeping	                        (rev 0)
+++ users/ryandesign/scripts/housekeeping	2012-01-13 02:18:15 UTC (rev 88826)
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# Performs some MacPorts housekeeping tasks that should be run periodically.
+
+if [ $(id -u) -ne 0 ]; then
+    echo "$(basename "$0") must be run as root" 1>&2
+    exit 1
+fi
+
+PREFIX="$(which port | sed 's,/bin/port$,,')"
+
+if [ ! -d "$PREFIX" ]; then
+    echo "port command not found" 1>&2
+    exit 1
+fi
+
+# Delete distfiles more than 2 years old.
+find "$PREFIX/var/macports/distfiles/" -type f -mtime +730 -print -delete
+
+# Delete incomplete distfile downloads more than 1 day old.
+find "$PREFIX/var/macports/distfiles/" -type f -name '*.TMP' -mtime +1 -print -delete
+
+# Delete empty distfile directories.
+find "$PREFIX/var/macports/distfiles/" -type d -empty -print -delete
+
+# Delete incomplete package downloads more than 1 day old.
+find "$PREFIX/var/macports/incoming/" -type f -name '*.TMP' -mtime +1 -print -delete
+
+# Delete logs more than 1 month old.
+find "$PREFIX/var/macports/logs/" -type f -mtime +30 -print -delete
+
+# Delete empty log directories.
+find "$PREFIX/var/macports/logs/" -type d -empty -print -delete
+
+# Delete files moved aside by "sudo port -f activate".
+find "$PREFIX" -path "$PREFIX/var/macports" -prune -o -regex '.*\.mp_[0-9]*$' -print -delete


Property changes on: users/ryandesign/scripts/housekeeping
___________________________________________________________________
Added: svn:executable
   + *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120112/a796bfc9/attachment.html>


More information about the macports-changes mailing list