ksh temporary directory

From: Jean-Marc Monnez (monnez.jean-marc@AGORA.MSA.FR)
Date: Tue Apr 01 2003 - 12:35:21 EST


AIX 4.3.2, scripts used as daemons.
Under certain conditions, for example a while loop (infinite or not) the
input redirection << generates a file /tmp/sh<ksh-pid>.1 containing the
characters redirected to stdin.
Hereafter is a simple sample script :
-----------------------------
#!/bin/ksh
while true
do
cat <<END

hello
END
sleep 10
done
-------------------------
When such a script is running, for example as process 12345, a file
/tmp/sh12345.1 , and the file contains :
------------------

hello
------------------
If the while loop is suppressed, the tmp file is not generated
If the loop is finite, and the script ends, then the tmp file disappears

If the tmp file is removed during the loop running, an error is
generated and the script aborts :
$ll /tmp/sh*
-rw-r--r-- 1 user group 7 Apr 01 19:10 /tmp/sh35110.1
$rm /tmp/sh*
==> then at next loop
tstscript[5]: /tmp/sh35110.18: 0403-005 Cannot create the specified
file.

The modify date of the file remains the same, so if such a daemon script
has to run for weeks (never stop), and an admin clears all /tmp files
older (modify time) than 6 days f.e., then the daemon script aborts !

I'd like to :
- either specify the ksh not to generate these tmp files and work with
memory data, even for input redirections inside loops
- either position the tmp directory to something I choose (not the
default /tmp)

Of course I didn't find anything myself neither in documentation, nor
with Google.
Anyone knows ?
TIA

-- JMM

-----------------------------
Jean-Marc MONNEZ
MSA / AGORA / ATD
monnez.jean-marc@agora.msa.fr
-----------------------------





This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:42 EDT