removetemp
Package: WA2L/edrc 1.5.57
Section: Library Commands (3)
Updated: 14 August 2008
Index
Return to Main Contents
NAME
removetemp - remove temporary directory created by maketemp
SYNOPSIS
edrc/lib/removetemp
[
-h
]
removetemp
[
-s scriptname
] [
-q
]
-d tempdir
AVAILABILITY
WA2L/edrc
DESCRIPTION
remove a temporary directory created by
maketemp(3).
Directories not created by
maketemp
will not be removed by the
removetemp
command.
Use the
listtemp(3)
command to list the state of temporary directories created by
maketemp.
OPTIONS
- -h
-
usage message.
- -s scriptname
-
scriptname in message output of
removetemp.
- -q
-
quiet, no message output.
- -d tempdir
-
temporary directory as returned by the
maketemp
command.
See section
EXAMPLES
for additional information.
ENVIRONMENT
-
EXIT STATUS
- 0
-
no error.
- 1
-
cannot remove specified temporary directory.
- 2
-
directory not removed because it was not created using the
maketemp(3)
command.
- 3
-
specified temporary directory does not exist.
- 4
-
usage message listed.
- 5
-
cannot access the specified temporary directory.
FILES
- <tempdir>/
-
temporary directory to be removed.
- <tempdir>/.maketemp.flagfile
-
flagfile containing the state information about the command that created
the temporary directory. This file is created by the
maketemp(3)
command while creating the temporary directory and read by
removetemp(3)
and
listtemp(3).
EXAMPLES
- 1) remove a tempdir created in '/tmp':
-
[ /root ]
[ root@acme001 ][-sh]: maketemp -d /tmp/.example
/tmp/.example.3430.2Hpt0D/
[ /root ]
[ root@acme001 ][-sh]: removetemp -d /tmp/.example.3430.2Hpt0D/
- 2) create/use/remove a tempdir in '/tmp' in a script:
-
#!/bin/sh
Scriptname=`basename $0`
Tmp=`maketemp -s $Scriptname -d /tmp/.$Scriptname` || exit 11
:
:
cat /etc/passwd | sort > ${Tmp}sorted_passwd
:
:
removetemp -q -d ${Tmp}
SEE ALSO
edrcintro(1),
listtemp(3),
maketemp(3),
purgetemp(3),
NOTES
-
BUGS
if the tempdir is created in a temporary directory location where
a regular file cleanup is configured,
removetemp
will not be able to remove the directory specified in the
-d
option, due to the fact that the
.maketemp.flagfile
might be removed by the cleanup function.
Cleanup
crontab
entry that would cause the behaviour described:
#
# delete all files in /tmp which are older than one week
#
00 1 * * * find /tmp \( -mtime +7 -a -type f \) -exec /bin/rm {} \;
AUTHOR
removetemp was developed by Christian Walther. Send suggestions
and bug reports to wa2l@users.sourceforge.net .
COPYRIGHT
Copyright © 2008
Christian Walther
This is free software; see
edrc/doc/COPYING
for copying conditions. There is ABSOLUTELY NO WARRANTY; not
even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This document was created by man2html
using the manual pages.
Time: 16:54:13 GMT, August 28, 2024