You are not logged in.

#1 2006-12-27 23:47:53

juergen
Developer
From: Frankfurt/Germany
Registered: 2005-04-11
Posts: 48
Website

sort installed packages by most recent access time...

If you run out of disk-space it might be useful to find packages not recently used. So i wrote this little script:

#!/bin/bash

LOCAL_DB=/var/lib/pacman/local

usage() {
cat <<EOF> most recent access times of all packages:
# pkgatime

Example Usage 2 -> most recent access times of apache:
# pkgatime apache

EOF
}

seconds_to_humandate() {
    date -d "01/01/1970 $1 seconds UTC"
}

if [ "$1" = "--help" -o "$1" = "-h" ]; then
    usage
    exit 0
fi

for packagedir in `find $LOCAL_DB -mindepth 1 -maxdepth 1 -type d -name ${1}*`;do
    package=`basename $packagedir`
    db_file=$packagedir/files
    seconds=`awk '$1 ~ //[^/]+$/ {if (NF==1) print "/"$1}' ${db_file}|xargs stat --format "%X"|sort -n|tail -n 1`
    if ${PIPESTATUS[1]} ;then
    echo $package $seconds `seconds_to_humandate $seconds`
    fi
done|sort -k 2 -n

Or download from here: http://www.hoetzel.info/Hacking/archlinux/pkgatime

Jürgen

Offline

#2 2007-06-02 13:01:34

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 671
Website

Re: sort installed packages by most recent access time...

Looks usefull smile

But I get
find: les chemins doivent précéder l'expression
Usage: find [-H] [-L] [-P] [CHEMIN...] [EXPRESSION]
Which in English that would be something like:

find: dir must preced expression
Usage: find [-H] [-L] [-P] [CHEMIN...] [EXPRESSION]

I'd like to merge it somehow with wain's pacstats

Last edited by kozaki (2007-06-02 13:02:22)


Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

Board footer

Powered by FluxBB