avpatil
11th March 2003, 15:18
Hi,
We are on Baan IVc3 on NT. Is it safe to delete the tmp* files under tmp directory. I also notifce some files with qp*. Can we delete the same?
Thanks
Arvind Patil
victor_cleto
11th March 2003, 17:21
The safest is to delete only the files older than one week, then you're pretty sure that they are defenely not in use/needed anymore.
Check this thread for some more info about BSE_TMP: http://www.baanboard.com/baanboard/showthread.php?threadid=1033&s=&perpage=5&pagenumber=1&display=show
ssbaan
11th March 2003, 17:36
We 'purge' the tmp file using the session ttaad3221m000 (Purge Device Queue) as this will remove files from the temp directory as
well as the BaaN table for device requests (I believe is ttaad320).
Thus just removes the 'tmp' files and the 'qp' files will have to be
removed form NT manually.
Hope this helps some!
OmeLuuk
12th March 2003, 08:55
tmp files are not only related to printfiles.
There are other actions that also create tmp files (compiling etc), that are not regulated from Baan. So best procedure would be: first clean up the printqueue using the session, then remove files that have been created more than 7 days ago. Note that users that log on for a long period of time (jobdaemon, CFO etc) may keep files in use over the weekend ... these should not be removed, doing so may crash the clients.
Indeed there are more files that may be deleted (provided old enough and not in use):
bshell* = logfiles from active bshell users (bhsell.PID)
prtmp* = ??? I saw them though
qp* = query processing files
tmp* = printer, compiling, PMC, miscellaneous (note: there are also directories tmp*d)
srt* = sort files (reports)
croezen
12th March 2003, 16:53
Hi guys,
I have been reading this thread and I delete files older then 1 week manually or ( after reboot ) delete all the files.
Needless to say this is a timeconsuming job and if i forget this for a couple of weeks there a more then 10.000 files in de temp directory.
Does anybody has an idee how to automate this.
I could make a job on NT that executes "Del C:\Baan\tmp\*.*" but i can't get the timeframe into this command.
As far as i know there is no option in de command line to delete files older then one week.
Anybody ?
zardoz
12th March 2003, 17:20
I have this solution (only for Unix, sorry NT users :D )
#! /usr/bin/ksh
#----------------------------------------------------------------------------
# Removes temporary files in $BSE_TMP not accessed by N days
# Note that only tmp*, bshell* and qp* are affected.
#----------------------------------------------------------------------------
BSE=/data1/baan4/bse
BSE_TMP=/data1/baan4/bse/tmp
export BSE BSE_TMP
if [ $# -lt 1 ];then
echo "Usage: tmpclean <days>"
exit 1
fi
echo "Deleting files (unused by" $1 "days) from $BSE_TMP"
cd $BSE_TMP
for file1 in $(ls tmp* bshell* qp*)
do
if [[ -z $(find . -name $file1 -atime -$1) ]]
then
rm -fe $file1
fi
done
patvdv
12th March 2003, 17:26
The obvious answer is always (in response to NT questions): buy a UNIX box ;)
But that doesn't help you of course. I got a tip from a collegue who said that this can be accomplished by a small PERL script. The only requirement of course is that you have PERL installed and it's ::date library/module.
lbencic
12th March 2003, 18:06
I have also had similar problems, and I don't know PERL :(
I have written similar logic in Baan using shell commands to send the directory listing to a file, then parse through the file using the seq.* commands to process - in your case, delete.
You can use the command 'dir /O-D > outputfile' to list in date descending order to the ASCII file names 'outputfile', then parse the date field from the file and decide if it's time to delete or not.
This can be run as a batch job in Baan to clean up things nightly.
Not very eloquent, I admit, but it has worked for me in the past.
Good luck
NPRao
12th March 2003, 19:33
Lisa,
If you are on a BaaN-NT installation, you can write a BaaN 3-GL program to open the $BSE/tmp directory with - dir.open() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_directory_file_operations_dir_open) and then use - file.stat() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_directory_file_operations_file_stat) to remove the files based on last accessed/modified/changed times.
Heres a sample code-
long fd
long rt
long size
long mode
string home(80)
string fname(80)
home = getenv$("GETCWD")
fd = dir.open(home)
fname=dir.entry(fd, TDIR+TFILE, rt, size, mode)
while (not isspace(fname))
fname=dir.entry(fd, TDIR+TFILE, rt, size, mode)
endwhile
e = dir.close(fd)
Caution- This program has to be executed only on the Server end.
OmeLuuk
13th March 2003, 11:00
croezen: Does anybody has an idee how to automate this.Read HELPDESK 17 pagina 7 Tips en trucs voor WindowsNT en Windows2000 (deel 1)
The idea behind this article is this:set DELTMPDIR=g:\baan\tmp
for /f %%a in (%DELTMPDIR%\cleanlist.dir) do @del %%a
del %DELTMPDIR%\cleanlist.dir
for /f %%b in ('dir /a-d /b %DELTMPDIR%\tmp*') do @echo %%b >> %DELTMPDIR%\cleanlist.dirso the factor time is eliminated by using a temp file.
croezen
13th March 2003, 12:31
Thank you guys for your input.
I needed that to get on the right track.
My endresult is ;
declaration:
long fd
long rt
long size
long mode
long file.size
long change.time
long modified.time
long access.time
long check.time
string home(80)
string fname(80)
choice.cont.process:
on.choice:
home = bse.tmp.dir$()
check.time = (date.num() - date.to.num(1970,1,1) - 7) * (24 * 3600)
fd = dir.open(home)
repeat
fname = dir.entry(fd, TDIR+TFILE, rt, size, mode)
if not isspace(fname) then
if file.stat( home & "\" & fname,
file.size,
change.time,
modified.time,
access.time) = 0 then
if access.time < check.time then
file.rm(home & "\" & fname)
endif
endif
endif
until (isspace(fname))
e = dir.close(fd)
ssbaan
13th March 2003, 15:42
For all of you Uinx people, here is a quick one- liner for removing files older that 7 days and logging the filenames that were deleted
find /$BSE/tmp -mtime +7 -depth | tee -a $OUTFILE | xargs rm -f