I wrote this shell script:

#!/bin/sh

PATH=/sbin:/usr/bin:/usr/sbin; export PATH

echo "Content-type: text/html"
echo ""

ROOT=/app/webchecker/controller
FILEIN=$ROOT/log/servcheckerstat.txt
FILEDOWN=$ROOT/bin/down_
FILEOUT=/tmp/wcHtmlStat.$$
$ROOT/bin/servckhtmlstat W $FILEIN $FILEDOWN $FILEOUT $QUERY_STRING
cat $FILEOUT
rm -f $FILEOUT
exit 0

servckhtmlstat is a C program which do all the job and write the file.

The problem is:

the shell script doesn't remove the temporary file .... why ????

P.S

I call the script from an html page.

the html page is probably being run as "nobody" or another user of the sort. do an ls -l on the file you are trying to remove, and check the permissions, and the ownership of the file. If the permissions are not set correctly.... it won't remove the file.

the html page is probably being run as "nobody" or another user of the sort. do an ls -l on the file you are trying to remove, and check the permissions, and the ownership of the file. If the permissions are not set correctly.... it won't remove the file.

The user is the same as the file owner.

Ok, And The permissions are set correctly (700, or 755 or something like that) so that the owner has permissions to delete?

Also, This seems silly that it would have any effect, but try making the shell script remove the file WITHOUT using the variable.... try it with a literal and see if it removes the file. If it does, then it's something with the variable, if it doesn't.... well, it's something else.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.