diff options
author | David Walter Seikel | 2012-11-13 18:30:27 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-11-13 18:30:27 +1000 |
commit | e424e084e77ed393b937f4ec1e726e40a8078da0 (patch) | |
tree | a28f84e92b2a7390b950de2cddc84f480d7fc1c5 | |
parent | Typo-- (diff) | |
download | IGnoble-e424e084e77ed393b937f4ec1e726e40a8078da0.zip IGnoble-e424e084e77ed393b937f4ec1e726e40a8078da0.tar.gz IGnoble-e424e084e77ed393b937f4ec1e726e40a8078da0.tar.bz2 IGnoble-e424e084e77ed393b937f4ec1e726e40a8078da0.tar.xz |
Delete old backups.
Diffstat (limited to '')
-rwxr-xr-x | start-sim | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1,5 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | # Number of days to keep backup OAR files. | ||
4 | DAYS="15" | ||
5 | |||
3 | USER=$(whoami) | 6 | USER=$(whoami) |
4 | console_name="OpenSim_console" | 7 | console_name="OpenSim_console" |
5 | screen_command="tmux -S /var/run/opensim/opensim-tmux.socket" | 8 | screen_command="tmux -S /var/run/opensim/opensim-tmux.socket" |
@@ -97,6 +100,8 @@ case $(basename $0) in | |||
97 | ;; | 100 | ;; |
98 | 101 | ||
99 | "backup-sim") | 102 | "backup-sim") |
103 | # 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. | ||
104 | find "${inidir}/../../backups/" -name "${title// /_}-*.oar" -mtime +${DAYS} -type f -print0 | xargs -0 /bin/rm -f | ||
100 | # Substitute underscores for spaces in the title, then add the full date and time to create the OAR file name. | 105 | # Substitute underscores for spaces in the title, then add the full date and time to create the OAR file name. |
101 | cmd="save oar ${inidir}/../../backups/${title// /_}-$(date '+%F_%T').oar" | 106 | cmd="save oar ${inidir}/../../backups/${title// /_}-$(date '+%F_%T').oar" |
102 | ${screen_window}:"[${title}]" \; send-keys "${cmd}" Enter | 107 | ${screen_window}:"[${title}]" \; send-keys "${cmd}" Enter |