pacman’s cache strikes again
~/.config/fsniper/scripts/pacman-cache.sh
#!/bin/bash
# This script checks the pacman cache directory and runs a command if it is over a certain size.
MAXSIZE="3500" # run the command you if the cache is over this size (in mb)
# run this command if CACHE is > MAXSIZE
COMMAND="echo \"oh no pacman's cache is over $MAXSIZE\" | mail -s \"pacman warning\" me@gmail.com "
CACHE="/var/cache/pacman/pkg" # cache location
if [[ "`du -sm $CACHE`" > "$MAXSIZE" ]]; then
$COMMAND
fi
and in ~/.config/fsniper/config
/var/cache/pacman/pkg/ {
* {
handler = pacman-cache.sh %%
}
You could make this more generic by passing %d in the fsniper handler and a size there too. Then adjust your script to handle those instead of hardcoding your values.
Comment by Dave Foster — November 6, 2008 @ 8:10 am
@Dave Foster
true, if I ever have another directory like that that fills up /var :|
Comment by andrewy — November 6, 2008 @ 9:49 am