Monday cleaning tasks (Cron jobs)

Every Monday night I run a series of automated cron jobs to free up disk space and keep the system tuned. The jobs empty some temporary folders which is not really necessary, and often consumes a lot of disk space.

These cron jobs should help keep unnecessary, hard disk consumption to a minimum! My Monday schedule should work on all Gnome default Debian and Ubuntu system, but remove the software you do not have installed.

Access the cron job editor by typing sudo crontab -eu root in a Terminal window. Then add the following to your cron job files (given that you have the applications, remove those you do not have):

# Monday tasks

# Remove old apt-get packages and refresh repositories
0 3 * * 1 root apt-get clean >/dev/null 2>&1
1 3 * * 1 root apt-get update >/dev/null 2>&1

# Remove thumbnail caches not accessed for a week
4 3 * * 1 root find /home/*/.thumbnails -type f -atime +7 -exec rm {} \; >/dev/null 2>&1

# Remove Evolution caches not accessed for a week
5 3 * * 1 root find /home/*/.evolution/cache/tmp -type f -atime +7 -exec rm {} \; >/dev/null 2>&1

# Remove gFTP caches not accessed for a week
6 3 * * 1 root find /home/*/.gftp/cache -type f -atime +7 -exec rm {} \; >/dev/null 2>&1

# Empty deleted item's folder
7 3 * * 1 root rm /home/*/.Trash/* >/dev/null 2>&1

Then save the changes, exit, and you are done!

And as a Web content provider, you can see that I have taken the middle way regarding caches. It is all about finding a balance between bandwidth-, and local hard disk consumption.

Feel free to comment if you have other suggestions that should have be added to my cron job list!

Copyright © 2007 Daniel Aleksandersen 2007-01-08 at 11:01

« First blog Wii-sitor | Home | Mozilla's revenue from partnering with Google »

2 comments

Before you set this set up these conjobs, remember to check that the command dosent delete files you want to keep. (The moral is never trust a Internet source completley, no offence Daniel)
Its very simple, replace the rm with echo, and remove >/dev/null 2>&1. The last string sends it all to /dev/null, meaning you will not get any output.

The command should look like this:
find /home/*/.thumbnails -type f -atime +7 -exec echo {} \;

This simply gives you a output of the files that will be deleted when running the command from cron :)

Comment by Alexander Davidsen at 2007-01-12 @586.

what about ~/.nautilus/ files?

Comment by zika (Subscribed) at 2009-02-13 @657.

Leave your comment




Related entries Stay informed

Get a free subscription to new entries in the Open Source Notebook!

News feed icon Navigation

Runbox Runbox logo
  • 10 GB email storage,
  • 1 GB file storage,
  • 100 MB attachment limit,
  • your own domain,

...and more! Get your own premium email for just 49 USD per year!

Categories Archives

The archive keeps a record of all entries that have ever been published! Have a look back in time, and see what was going on!

License

This blog entry text is licensed under a Creative Commons Sampling Plus 1.0 License. The license explained, and legal notes.

Creative Commons Sampling+


Copyright © 2006–2009 Daniel Aleksandersen | Legal, license and trademarks | Privacy policy