When a program is made with GTKdialog , it seems to be common practice to leave any files created in /tmp to be removed upon reboot.
But would it not be cleaner to add one line to the end of the script to remove the file in /tmp before exiting?
I will use as an example a program written to use a /tmp file called number.
The script is run. The /tmp/number file is created and used.
Upon exiting the script, the /tmp/number file is still there.
With the addition of one line, "rm /tmp/number" before the script is ended, the /tmp/number file is removed without rebooting.
End of script example:
gtkdialog3 -p MAIN_DIALOG
rm /tmp/number
unset -f add
unset MAIN_DIALOG
Comments?
GTKdialog leftovers
Hi 8-bit; I believe that /tmp is in ram and is not part of the union ( but I may be wrong...).
So that`s why it comes up clean after every boot, the Save file doesn`t over shadow it.
That`s why all temporary dirs., files, links, pipes, and even mount points are best put into /tmp
When I write an app. I usually make a /tmp sub dir. for it so it doesn`t make a mess out of /tmp
Like: /tmp/SambaBrowser
So that`s why it comes up clean after every boot, the Save file doesn`t over shadow it.
That`s why all temporary dirs., files, links, pipes, and even mount points are best put into /tmp
When I write an app. I usually make a /tmp sub dir. for it so it doesn`t make a mess out of /tmp
Like: /tmp/SambaBrowser
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
The only way it would leave a whiteout file in its place is if the file copies over one that exists in a unioned sfs.
Even better would be to create folder in tmp and remove the folder.
rather than a line of code for each file
also some programs leave the files there intentionally for debugging or other reasons
Even better would be to create folder in tmp and remove the folder.
Code: Select all
rm -rf /tmp/myprogramtmpfolder
also some programs leave the files there intentionally for debugging or other reasons
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
I guess what I am getting at here is that if /tmp is located in memory and one has a limited amount of memory, the /tmp files created take up memory that could be recovered by deleting them when the program ends.
If you want an extreme example, open a terminal and type free.
Now copy an big file to /tmp.
In the terminal, type free again.
Notice the decrease in free ram?
But I also noticed that deleting the big file from /tmp does not fully recover the free ram.
Puzzled....
If you want an extreme example, open a terminal and type free.
Now copy an big file to /tmp.
In the terminal, type free again.
Notice the decrease in free ram?
But I also noticed that deleting the big file from /tmp does not fully recover the free ram.
Puzzled....