LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   'Housekeeping' with /etc/rc.d/rc.local_shutdown? (https://www.linuxquestions.org/questions/slackware-14/housekeeping-with-etc-rc-d-rc-local_shutdown-660272/)

andrew.46 08-04-2008 03:01 AM

'Housekeeping' with /etc/rc.d/rc.local_shutdown?
 
Hi,

I have just started tinkering with /etc/rc.d/rc.local_shutdown which I plan on using for general 'housekeeping' rather than terminating any process in particular. At the moment I simply have:

Code:

#!/bin/sh

# Empty out the temp file:
rm -rf /tmp/*

# Lose all the ~ backup files:
find / -name '*~' -exec rm -rf {} \;

Can I ask if anyone else uses this file for a similar purpose or has a different approach?

Andrew

MS3FGX 08-04-2008 03:04 AM

Well, if you are going to delete /tmp every time you shut down, you might as well just mount that on tmpfs and be done with it. That will always give you a fresh /tmp without having to modify the boot scripts at all.

As for the backup files, if those are being created by vim (by default, vim will make those backup files in Slackware), then you can just configure vim to not make them. Unless there is another program running which is creating these files on your machine.

andrew.46 08-04-2008 05:49 AM

Thanks for your response:

Quote:

Originally Posted by MS3FGX (Post 3235912)
Well, if you are going to delete /tmp every time you shut down, you might as well just mount that on tmpfs and be done with it. That will always give you a fresh /tmp without having to modify the boot scripts at all.

My only idea was to flush /tmp at every shutdown. I had some trouble loading X at times when the temp directory was too full. Emptying it completely seemed to fix this trouble although I had not considered tmpfs.

Quote:

As for the backup files, if those are being created by vim (by default, vim will make those backup files in Slackware), then you can just configure vim to not make them. Unless there is another program running which is creating these files on your machine.
I feel a little insecure without those backup files so I went the middle ground with vim and added the following to my .vimrc:

Code:

set backupdir=/tmp    " Group backup files in this directory
so the backup files will vanish each reboot but be available while running.

Andrew

andrew.46 08-05-2008 07:59 PM

The idea of tmpfs was a little too radical for me so I eventually came up with a simple scheme for purging files older than 5 days which gives me the idiot factor I have been after:

Code:

#!/bin/sh

# Clears /tmp of files older than 5 days:
 find /tmp -mtime +5 -print | xargs rm -rf

Pretty simply but it accomplishes what I am after.

Andrew


All times are GMT -5. The time now is 02:15 PM.