Operating System - HP-UX
1833979 Members
2075 Online
110063 Solutions
New Discussion

Re: Setting up an env variable

 
SOLVED
Go to solution
Ronald Cogen
Frequent Advisor

Setting up an env variable

Hello out there!,

One of our developers uses the sort() system call rather extensively, which constantly writes stuff to /var/tmp. As /var/tmp is not very large it proposes a problem. I would like to set up a global variable which would redirect the path somewhere else. Where should I begin?

Thanks,
Ron
I've been down so long it looks like up to me
7 REPLIES 7
Jean-Louis Phelix
Honored Contributor
Solution

Re: Setting up an env variable

Hi,

$TMPDIR is used by sort.

Regards,

Jean-Louis.
It works for me (© Bill McNAMARA ...)
T G Manikandan
Honored Contributor

Re: Setting up an env variable

you can frequently clean /var/tmp.
you can schedule a cron job

# find /var/tmp -type f -mtime +7 -exec rm {} \;
# find /var/tmp -type d -mtime +7 -exec rm -r {} \;
Ronald Cogen
Frequent Advisor

Re: Setting up an env variable

Hello Jean Louis,

Where should I redefine $TMPDIR?

Regards,
Ron
I've been down so long it looks like up to me
Ken Hubnik_2
Honored Contributor

Re: Setting up an env variable

You can have the developers set their tmp to a different space by modifying their .profile or .kshrc. Also their is an option on the sort command sort -T directoryname. This will allow them to pick the temporary sort location. Do a man on sort and check out the -T option.
Jean-Louis Phelix
Honored Contributor

Re: Setting up an env variable

Hi,

You could define it either in your /etc/profile or directly in the program which calls sort (export TMPDIR=/xxx in shell, putenv("TMPDIR=/xxx") in C).

Regards,

Jean-Louis.
It works for me (© Bill McNAMARA ...)
Hamdy Al-Sebaey
Regular Advisor

Re: Setting up an env variable

Hi,
You can make a link to a big file system every thing which is comming to /var/tmp will go to the new FS.
Another method is to enlarge /var & to clean files which are older than a couple of days.
#/usr/bin/touch /var/tmp; /usr/bin/find /var/tmp -mtime +7 -exec -rm -rf {} \;

You can set this command at your crontab.

Regards,
Hamdy
Thanks for sharing knowledge
Darrell Allen
Honored Contributor

Re: Setting up an env variable

Hi Ron,

My first choice is to add space to /var.

Perhaps a workaround is to link /var/tmp to a directory in a filesystem with plenty of space. Still, since the OS expects /var/tmp to be used for sort (and other processes), it's best to give space where it is really needed.

You could also create /var/tmp as a separate filesystem with the space it needs.

Does the application clean up after itself? If not, I'd have a discussion with the developer.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)