- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Erase file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 06:49 PM
01-12-2005 06:49 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 06:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 06:55 PM
01-12-2005 06:55 PM
Re: Erase file
I would suggest you look at accomplishing this in either of the 2 ways listed below
1. This could be taken care in your
application program itself. If your
application is a script, right at the end
make sure that if the file /tmp/log.txt
is deleted
2. Else you submit a job in the cron with
$ rm /tmp/log.txt
and submit this cron job to be run every
10 mins or so, depending on the frequency
with which this log is created
regards
Mobeen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 06:57 PM
01-12-2005 06:57 PM
Re: Erase file
I am sorry i did not see your last part of the question about links....i think you could go ahead with the suggestion prior to my post...you would be fine...
rgds
Mobeen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 07:00 PM
01-12-2005 07:00 PM
Re: Erase file
then you could call unlink() inside the application
code (I'm assuming that application source is in C)
to delete the file. If you don't have access to the
source code, then you could use a small shell
script like the following:
--- Script start
./application_name
rm -rf /tmp/log.txt
---- End script
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 08:11 PM
01-12-2005 08:11 PM
Re: Erase file
I use the s.link function , it is OK to link the file , but the /tmp/log.txt is exist , even the file can't be update but I really don't want the file exist in the system , how can I make the file don't appear in the system ( even the file size is 0 ) ? thx
/tmp/log.txt -- > /dev/null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 08:18 PM
01-12-2005 08:18 PM
Re: Erase file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 08:21 PM
01-12-2005 08:21 PM
Re: Erase file
I can't see a way of prventing the application from creating the file, unless you change the permissions on /tmp to exclude the application owner from creating files via a Acccess Control List(man acl).
Either change the application or the code that causes the problem if the /tmp/log.txt file exists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 08:29 PM
01-12-2005 08:29 PM
Re: Erase file
But that is for the brave of heart only :)
(Men would I laugh when the application maintainers come in and don't understand why there is no log file written)
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2005 08:40 PM
01-12-2005 08:40 PM
Re: Erase file
how often is this file created? Just once when the application is started? You may write a script which checks the existence and deletes the files.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2005 01:12 AM
01-13-2005 01:12 AM
Re: Erase file
Anyways, in the startup script for the Application, add this to the end:
rm -f /tmp/log.txt
If it keeps re-creating it, how about a cron job that deletes every minute - if it exists:
* * * * * [ -f /tmp/log.txt ] && /usr/bin/rm -f /tmp/log.txt >/dev/null 2>&1
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2005 12:15 PM
01-13-2005 12:15 PM
Re: Erase file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2005 12:35 PM
01-13-2005 12:35 PM
Re: Erase file
like the following:
---- Start ---
./application &
while [ /bin/true ]
do
ps -ef | grep -v grep | grep -q application
if [ $? -eq 0 ]
then
rm -rf /tmp/log.txt
sleep 1
else
exit 0
fi
done
---- End ----
This script will start your application in background
and delete /tmp/log.txt every second. Once
your application is done and leaves, the script
will exit.
To tell you the truth, I would use the above
technique as a last option and would consider
re-designing the whole thing if I can.
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2005 12:56 AM
01-14-2005 12:56 AM
Re: Erase file
to run every second, you would have to call a script every minute, then in theat script, loop every second and issue your command. You have to be carefull - because your command might not finish in 1 second - and the next one kicks off...
sample code (not tested):
limit=60
while [ $limit -gt 0 ]; do
if [ -f /tmp/log.txt ] ; then
rm /tmp/log.txt
else
limit=0
fi
limit=`expr $limit - 1`
done
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2005 01:06 AM
01-14-2005 01:06 AM
Re: Erase file
If you have access to the source code, don't bother unlinking the file, just remove the logging functionality, or change your $LOGFILE var to /dev/null.
NB: If you decide to binary edit a file, make a backup first!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2005 02:05 AM
01-14-2005 02:05 AM
Re: Erase file
create a DIRECTORY called /tmp/log.txt with permissions d---------. Thus the application would be prevented from creating a file with the same name. Of course you might not want a directory called /tmp/log.txt hanging around either!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2005 01:39 AM
01-19-2005 01:39 AM
Re: Erase file
I think by far the best idea is:
ln -s /dev/null /tmp/log.txt