diff options
Diffstat (limited to 'start-sim')
| -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 |
