You are not logged in.

#1 2008-12-19 01:59:01

Maki
Member
From: Skopje, Macedonia
Registered: 2007-10-16
Posts: 353
Website

Simple maintanance scripts

Upon discovering the power of cron, i have made scripts to clean & backup important files from my system. They are really bare bones & some stuff are missing, but could be usefull in an event of a total meltdown, and run some trivial cleanup commands...


The backup script

#!/bin/bash
#        A litle script to make live easier
##Making a list of packages
pacman -Qqm > /data/backup/pkglocal >> /dev/null 2>&1
pacman -Qqe > /data/backup/pkglist >> /dev/null  2>&1
##Untar with  tar xvpfz foo.tar.gz -C "parent directory"
#backing up /etc
tar cvpzf /data/backup/etc.tar.gz /etc >> /dev/null 2>&1
#Backing up local package database, just in case.
tar cvpzf /data/backup/local.tar.gz /var/lib/pacman/local >> /dev/null 2>&1
#Backing up the /home dir.
tar cvpzf /data/backup/home.tar.gz --exclude=lost+found /home >> /dev/null 2>&1

The cleanup script

pacman -Sc --noconfirm >> /dev/null #2>&1
echo y|pacdiffviewer -c >> /dev/null #2>&1 ##probably doesn't work good
pacman-optimize >> /dev/null #2>&1

Any suggestion is more than apreciated


If it ain't broke, broke it then fix it.

Offline

#2 2008-12-19 11:42:24

dolby
Member
From: 1992
Registered: 2006-08-08
Posts: 1,581

Re: Simple maintanance scripts

Since pacman-optimize suggests running sync afterwards you might as well add it too


There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums.  That is why we avoid it. -- ewaller (arch linux forum moderator)

Offline

#3 2008-12-19 12:47:36

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: Simple maintanance scripts

Another note, "echo y | .." can be replaced with "yes | .." if I'm reading that correctly.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

Board footer

Powered by FluxBB