From e424e084e77ed393b937f4ec1e726e40a8078da0 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 13 Nov 2012 18:30:27 +1000 Subject: Delete old backups. --- start-sim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/start-sim b/start-sim index e2e1faa..b280a1d 100755 --- a/start-sim +++ b/start-sim @@ -1,5 +1,8 @@ #!/bin/bash +# Number of days to keep backup OAR files. +DAYS="15" + USER=$(whoami) console_name="OpenSim_console" screen_command="tmux -S /var/run/opensim/opensim-tmux.socket" @@ -97,6 +100,8 @@ case $(basename $0) in ;; "backup-sim") + # First delete old backups. Using mtime instead of ctime, so that people can touch files the want to keep, and coz ctime seems to have a bug. + find "${inidir}/../../backups/" -name "${title// /_}-*.oar" -mtime +${DAYS} -type f -print0 | xargs -0 /bin/rm -f # Substitute underscores for spaces in the title, then add the full date and time to create the OAR file name. cmd="save oar ${inidir}/../../backups/${title// /_}-$(date '+%F_%T').oar" ${screen_window}:"[${title}]" \; send-keys "${cmd}" Enter -- cgit v1.1