mkinittmpdir(1) FreeBSD General Commands Manual mkinittmpdir(1) NAME mkinittmpdir -- create or choose TMPDIR SYNOPSIS mkinittmpdir [-suxhv] [-f Config] [-d TmpDir] [-l TmpDirLink] [-t TimeToLive] [-n Nice] DESCRIPTION The main goal of mkinittmpdir is temporary directory creation or choose it from possible directories. Usually it creates or choose temporary directory as TmpDir/${USER} or TmpDir/${USER}_XXXXXX, (as in mkdtemp(3)) where TmpDir is from -d or TMPDIR parameter in config files. After choos- ing or creation directory for temporary files symbolic link to this directory created (if configured so). After directory and link estab- lishing mkinittmpdir execute all config files - system, user and forced (if configured so) with environment TMPDIR, TMPDIRLINK and DELETED then launch deleted(1) garbage collector daemon for chosen or created tempo- rary directory. mkinittmpdir do not create any directory if possible and do not change TMPDIRLINK if possible. Temporary directory can be chosen if it is writeable for user only. If several directories are possible then directory will be chosen in such a way that keep changes minimal. The following options are available: -s Do not use system wide config file. -u Do not use user config file. -x Do not execute any config file. -f file Forced config file. Parameters in it overrides variables in user and system config files. -d dir Forced temporary directory. USER_SUBDIR forbidden when -d is used. -l link Link to TMPDIR which can vary so TMPDIRLINK may be used as stable path for TMPDIR. This link is one of sources config information. -t TimeToLive TimeToLive argument for deleted(1) daemon. -n Nice Nice argument for deleted(1) daemon. -h Short help. -v Increase verbosity. More -v's result in more information. Configuration file can be executed if has #!/bin/sh as first string begin and has appropriate x bit. IMPLEMENTATION NOTES Configure information come from (listed high to low priority): o arguments list; o -f file; o TMPDIR environment variable; o user config file; o system wide config file; o mkinittmpdir predefined Configuration files format is: o Possible string begins with #!/bin/sh o Shell commands. o name=value pairs. o Strings begins with # are comments. Parameter names used: EXECUTE Permit or deny execution of config files in addition to use parameters from it. TMPDIR Overrides by -d in command string. /tmp if not defined. USER_SUBDIR Allow or forbid use subdirectory in TMPDIR. Overrides by -l in command string. Allow if not defined by another way. TMPDIRLINK Path to link to TMPDIR. Undefined by default. LINKED Allow or forbid use link to TMPDIR DELETED Path to deleted(1) daemon. DELETED_-t Time to live argument for deleted(1) daemon. DELETED_-n Nice argument for deleted(1) daemon. If creation or choose of TMPDIR is not successful or script executed returns nonzero exit code than mkinittmpdir try this without user config file and then without both user and system config files. If some config files do not used then appropriate try is skipped. RETURN VALUES mkinittmpdir always prints chosen or created temporary directory path to stdout without carriage return or line feed at end. If mkinittmpdir has no success in creation or choose temporary directory according to config- uration, then /tmp is printed to stdout without any test of /tmp. mkinittmpdir substitutes ``~/'' and ``~user/'' for real absolute path. ENVIRONMENT TMPDIR environment is used to configure mkinittmpdir besides other meth- ods. If TMPDIR environment points to link, then TMPDIRLINK= LINKED=YES assumed. If TMPDIR do not points to link then path in TMPDIR or path pointed by link TMPDIRLINK analised. If last component is ${USER} or ${USER}_XXXXXX then USER_SUBDIR=YES assumed and TMPDIR will be shortened one component. If path pointed by link or path from TMPDIR not pointing to link is another then USER_SUBDIR=NO and not changed TMPDIR are assumed. FILES /etc/tmpdirrc system wide configuration file ~/.desk/tmpdirrc user configuration file EXAMPLES mkinittmpdir intended for use in startup shell scripts: TMPDIR=`mkinittmpdir` in Bourne shells and setenv TMPDIR `mkinittmpdir` in C shells. DIAGNOSTICS mkinittmpdir works silently and 0 is the only exit code. -v can be used for debug print to stderr. COMPATIBILITY The main reason for use mkinittmpdir is TMPDIR setting. But it is a big work to do all applications TMPDIR aware. SEE ALSO mkdtemp(3), deleted(1) HISTORY The mkinittmpdir command appeared in FreeBSD 4.1 AUTHORS Aleksandr A. Babaylov (aka @BABOLO) .@babolo.ru http://www.links.ru/~babolo/ BUGS Man (text) originally written by man (human) with no active English. Do the better if can. FreeBSD 7.2 2000 April 28 FreeBSD 7.2