[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[debian-users:54637] Re: cronで自動削除
- From: Taku YASUI <tach@debian.or.jp>
- Subject: [debian-users:54637] Re: cronで自動削除
- Date: Wed, 10 Nov 2010 23:59:26 +0900
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=r5RGgWYRJKGVsq+mT+nIHBuj7Z06FZ36B5uPB9Lj0Ew=; b=YP1vMWkdFFLmlGag7PHYA642uANgWNBZfW4lVTPKNh6vSHpHDt/mT549ivZb3N6EHv dYITqCOmZtR6jodN5/4NYuxsCM8Z/1A1gk3oGD89czGJNa5wfmLklf1vMu9RuHh24MIP t5Gv2KAvCUQsnxEMvSvrwJQ+VrIqIqrXl+f24=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=RP6+gD6OLoA/PFjFqRbRPfDXCKxawQzXcTAbTvyx4FwS/lBWvikTcvyahiOhI+qffg 9KSRfGB4gMGam0qaaNVBDppd5mKYWp5zxbT7tNVfnU6kAna3y6E6eT2uV/x0d8dUEsDL xbWBx4eJ14k2W6xCZ5c/vb9pXAG1GGfxuGwZM=
- List-help: <mailto:debian-users-ctl@debian.or.jp?body=help>
- List-id: debian-users.debian.or.jp
- List-owner: <mailto:debian-users-admin@debian.or.jp>
- List-post: <mailto:debian-users@debian.or.jp>
- List-software: fml [fml 4.0.3 release (20011202/4.0.3)]
- List-unsubscribe: <mailto:debian-users-ctl@debian.or.jp?body=unsubscribe>
- X-google-sender-auth: xRxI070am8UTtJFiptM7bU_rXiQ
- X-ml-info: If you have a question, send e-mail with the body "help" (without quotes) to the address debian-users-ctl@debian.or.jp; help=<mailto:debian-users-ctl@debian.or.jp?body=help>
- X-ml-name: debian-users
- X-mlserver: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only members can post)
- X-sender: taku.yasui@xxxxxxxxx
- X-spam-checker-version: SpamAssassin 3.1.7-deb3 (2006-10-05) on osdn.debian.or.jp
- X-spam-level:
- X-spam-status: No, score=-1.6 required=10.0 tests=AWL,KI autolearn=disabled version=3.1.7-deb3
- References: <4CD9E1B8.3050107@xxxxxxxxxxxxxxx> <87tyjpyczt.wl%fumiyas@xxxxxxxxxx>
- Message-id: <AANLkTimR2i9TP3oDLx4=u_wFm-xJ-EGZP64VmeTZ4E9M@xxxxxxxxxxxxxx>
- X-mail-count: 54637
やすいです。
2010/11/10 SATOH Fumiyasu <fumiyas@xxxxxxxxxx>:
> find /var/www/gomibako -type d -mtime '+7' -print0 |xargs -0 rm -rf
これだと、二つ問題があると思います。
1. find で見つからなかったときに rm -rf に渡る引数が無くなる
(エラーにはならないけど)
2. 更新が全然無かったときに、/var/www/gomibako 自身が消える
1. は、xargs に -r をつければ回避できます。
2. は、find に -mindepth 1 をつければ回避できます。
find /var/www/gomibako -mindepth 1 -type d -mtime '+7' -print0 | xargs
-0r rm -rf
ですかね。
それでは。
--
Taku YASUI <tach@debian.org>