User:Evilgold/scipts

Backing up .mozilla (firefox settings):

find ~/.mozilla/firefox/ -type f -name "*.sqlite" -exec sqlite3 {} VACUUM \; find ~/.mozilla/firefox/ -type f -name "*.sqlite" -exec sqlite3 {} REINDEX \; tar czvf ~/Backups/mozilla-backup.tar.gz ~/.mozilla --exclude=cache

This script first attempts to clean the sql database firefox uses, then creates a tarball of all the files in the .mozilla folder, except for the cache, which isnt needed and usually takes up most of the space. If for whatever reason you want to backup the cache too, just remove --exclude=cache

Backup .purple (pidgin) except for chat logs

tar czvf ~/Backups/purple.tar.gz ~/.purple --exclude=logs

Move /usr to a squashfs loop filesystem (archlinux only)

if $UID != "0" ;then echo "This script MUST be run as root" echo "Please login to the root account" echo "And re-execute this script" exit fi echo "This script will place /usr into a squashfs for faster loading" read -p "Press enter to continue" pacman -Sy --needed aufs2 aufs2-util squashfs-tools echo mkdir -p /squashed/usr/{ro,rw} if -e /var/lib/pacman/db.lck ; then echo "Pacman seems to be in use, please wait for it to finish" echo "before you create the squashfs image or else nasty things" echo "will most likely happen to your system" else mksquashfs /usr /squashed/usr/usr.sfs -b 65536 fi echo "Please add the following lines to your /etc/fstab" echo echo "/squashed/usr/usr.sfs   /squashed/usr/ro squashfs     loop,ro 0 0" echo "usr /usr aufs  br:/squashed/usr/rw:/squashed/usr/ro 0 0" echo read -p "Press any key to continue after you finished editing the file" echo mv /usr /usr.old mkdir /usr echo "Would you like to set up a cron job to remake the image" echo "Every three weeks? (y or n)" read choice if choice == "y" ;then #sets up a cron job to remake the image every three weeks echo "Please add the following to your crontab" echo "and place remake-squash.job in /etc/cron.monthly" echo echo "It will remake the sqashfs image every 21 days at noon" echo echo "0 12 21 * * bash /etc/cron.monthly/remake-squashfs.job" fi
 * 1) !/bin/bash
 * 2) Created by Brando56894 from the Arch Linux Community
 * 3) Based off of a tutorial found on the Gentoo forums
 * 4) This script comes with ABSOLUTELY NO WARRANTY use it at your risk!
 * 5) checks to see if the user is root
 * 1) installs aufs2 and squashfs tools
 * 1) creates the directories that /usr will be squashed into
 * 1) compress /usr into a squashfile with a 64k blocksize
 * 1) adds the filesystems to fstab
 * 1) probably not needed since the umount -a option should do it but left it in case it is needed
 * 2) unmounts the squashfs during shutdown
 * 3) echo "Please add the following lines to /etc/rc.shutdown"
 * 4) echo "under the Unmounting Filesystems section"
 * 5) echo
 * 6) echo "umount -l /usr"
 * 7) echo "umount -l /squashed/usr/ro"
 * 8) echo
 * 9) read -p "Press any key to continue after you finished editing the file"
 * 10) echo
 * 11) move the /usr folder instead of deleting it