0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linux上でバックアップファイル群を適当にrotate

Last updated at Posted at 2018-07-20

毎日バックアップしている何らかのファイル群を適当にrotateするときに使っています。

#!/bin/bash
_BACkUPDIR='/backup'
_limit=10

find "${_BACKUPDIR}" -type f -ctime "+${_limit}" -exec \rm -fv {} \; | logger

この例では、バックアップファイルのctimeが10日以前のファイルを削除しています。
rmの処理は怖いですがcronにワンライナー書けばとりあえず動くので便利です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?