.\" Copyright (C) @BABOLO V.M 0.2 ΟΤ 2000 May 25 .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD: $ .\" .Dd 2000 May 25 .Dt deleted 1 .Os .Sh NAME .Nm deleted .Nd garbage collector in directory for temporary files. .Sh SYNOPSIS .Nm .Op Fl vh .Op Fl t Ar TimeToLive .Op Fl n Ar Nice .Op Fl d Ar Mask .Op Fl f Ar Mask .Ar TmpDir .Pp .Nm .Op Fl qvh .Ar TmpDir .Sh DESCRIPTION .Nm is a garbage collector in directory for temporary files. It deletes any object in directory tree if it is old enough .Po more then .Fl t Ar TimeToLive old .Pc . .Pp Before delete of directory or regular file .Nm try to apply an advisory lock on the object. If lock is successful, then object will be deleting, else age of object resets to zero and object will not be deleting. .Pp Note, that deleting of any object from directory always change mtime of directory and resets age to zero, so emptied directory will be deleted not earlier than .Fl t Ar TimeToLive after be emptied. .Pp The following options are available: .Bl -tag -width Fl .It Fl t Ar TimeToLive the age of objects have to be deleted. Obligatory parameter. .Pp The default age of directory is youngest of .Va ctime and .Va mtime .Ns . See .Fl d for non default settings. .Pp The age of symlink is youngest of .Va atime , .Va ctime , .Va mtime of the link .Po if not changed by .Fl f .Pc and the age of object link points to. .Pp The default age of regular files and other objects is youngest of .Va atime , .Va ctime and .Va mtime . See .Fl f for non default settings. .Pp Any case following letters can be used in .Ar TimeToLive : .Bl -tag -width --- .It S seconds. .It M minutes .Po 60 seconds .Pc . .It H hours .Pq "60 minutes" . .It D days .Pq "24 hours" . .It W weeks .Pq "7 days" . .It Y years .Pq "53 weeks" . .It no letter seconds. .El .It Fl n Ar Nice priority as in .Xr nice 1 .It Fl f Ar [amc]* points to times used to evaluate age of files and other non directory objects .Bl -tag -width --- .It a use atime .It m use mtime .It c use ctime .El .Pp The default is .Fl f Ar amc .It Fl d Ar [amc]* points to times used to evaluate age of directory. Coding is the same as for .Fl f Ns . The default is .Fl d Ar mc .It Fl q do not delete anything, just query .Nm running in .Ar TmpDir about its parameters. .It Fl h Short help. .It Fl v Increase verbosity. More .Fl v Ns \&'s result in more information. .El .Pp If started in directory with .Nm already started then one of .Nm dies and other works with last .Nm parameters. .Pp .Nm does not detach yourself from terminal. Use .Xr mkinittmpdir 1 to launch .Nm or detach it by shell command. .Sh FILES .Bl -tag -width -deleted.pid- -compact .It Pa +deleted.pid= file in .Ar TmpDir directory to handle .Nm parameters and inter .Nm coordination. .El .Sh EXAMPLES The following is an example of a typical usage of the .Nm command: .Dl deleted -t 2w3d43200 -n 10 ${TMPDIR} & launch .Nm with .Ar nice 10 and .Ar TimeToLive 2.5 weeks .Pq "2 weeks 3 days 43200 seconds" . To query about .Nm use: .Dl deleted -q ${TMPDIR} .Sh SEE ALSO .Rs FreeBSD PR bin/18275: proposed TMPDIR setting and mkinittmpdir .Re .Rs http://links.ru/FreeBSD/mkinittmpdir/ .Re .Rs .Xr mkinittmpdir 1 , .Xr chroot 2 , .Xr stat 2 , .Xr nice 1 . .Re .Sh HISTORY .Nm was written in 2000 for .Os FreeBSD ports collection to work in companion with .Xr mkinittmpdir 1 .Sh AUTHORS .An Aleksandr A. Babaylov .Pq "aka @BABOLO" .Ad .@babolo.ru .Tn http://www.links.ru/~babolo/ .Sh BUGS Man .Pq text originally written by man .Pq human with no active English. Do the better if can. .Pp .Nm do .Xr chroot 2 to .Ar TmpDir so symlinks with absolute path can point to invalid or no objects. This affects symlinks age estimation. .Pp All parameters of .Nm is affected by subsequent .Nm execute. Parameters must not change if not explicitly declared. For example if .Nm is launched by .Dl deleted -t 2w -n 10 ${TMPDIR} & and subsequent .Dl deleted -t 3d ${TMPDIR} execute change TimeToLive .Pq "as wished" and Nice .Pq "may be undesired" .