#!/bin/sh
# Remove old logs from database

# FIXME : Should be merged to control-center.py

# Number of days of logs to keep in history
MAX_AGE=${MAX_AGE:-"5"}
DB=${DB:-"ltsp"}

export LC_ALL=C
su postgres -c "echo delete from log where ts \< now\(\) - interval \'$MAX_AGE days\' | psql -d $DB"

