Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # $Id: cleanup-gwibber,v 1.1 2013/04/26 15:00:20 elias Exp $
- # Remove obsolete junk from gwibber's sqlite database
- #
- # Sorry, I do my calculations in bash syntax.
- #
- ########################################################################
- #
- # Configuration
- # -------------
- #
- # Directory for Gwibber's database
- #
- db_dir=~/.config/gwibber
- #
- # Name of Gwibber's database
- #
- db_name=gwibber.sqlite
- #
- # Number of days messages should be kept in the database
- #
- db_keepdays=30
- #
- ########################################################################
- #
- # Program
- # -------
- #
- db_path=$db_dir/$db_name
- db_keepsecs=$(($db_keepdays * 24 * 60 * 60))
- db_deletebefore=$((`date +%s` - $db_keepsecs))
- #
- sqlite3 "$db_path" <<EOF
- delete from messages where time < $db_deletebefore;
- vacuum;
- EOF
- #
- ########################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement