LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-04-2008, 03:01 AM   #1
andrew.46
Member
 
Registered: Oct 2007
Distribution: Slackware
Posts: 646

Rep: Reputation: 90
'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
 
Old 08-04-2008, 03:04 AM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
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.
 
Old 08-04-2008, 05:49 AM   #3
andrew.46
Member
 
Registered: Oct 2007
Distribution: Slackware
Posts: 646

Original Poster
Rep: Reputation: 90
Thanks for your response:

Quote:
Originally Posted by MS3FGX View Post
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
 
Old 08-05-2008, 07:59 PM   #4
andrew.46
Member
 
Registered: Oct 2007
Distribution: Slackware
Posts: 646

Original Poster
Rep: Reputation: 90
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Housekeeping utilities for Debian packages LXer Syndicated Linux News 0 12-01-2006 04:21 AM
Kmail, usage and "housekeeping" JZL240I-U Linux - Software 1 02-24-2005 04:38 AM
A source code housekeeping question Dewar Linux - General 1 12-11-2003 07:02 PM
Linux Housekeeping GtkUser Linux - General 6 02-03-2003 07:54 PM


All times are GMT -5. The time now is 05:23 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration