Script kings this way please-->

Soldato
Joined
19 Oct 2002
Posts
6,943
Location
Bath
Right guys I'm a bit of a noobie when it comes to scripting and cron jobs and the like.
So what I'm looking for is anyone that is willing to write me a script that will backup two folders (Firefox preferences and Thunderbird emails) every time i shutdown or log off my Ubuntu box.

location of Firefox prefs /home/ian/.mozilla/firefox
location of Thunderbird email /home/ian/.mozilla-thunderbird

and the save location is /media/hdb1/Backup

I would prefer them tared and ziped and for it to keep one previous file if this is possible.

i know how to do most of this within windows and im sure its possible to do it within Ubuntu i just dont know how!

Any help would be greatly appreciated.

Thanks in advance
Ian
 
Something along the lines of:

cd /media/hdb1/Backup

mv firefox-cur.tar.gz firefox-old.tar.gz
tar -cf firefox-cur.tar /home/ian/.mozilla/firefox/*
gzip firefox-cur.tar

mv thunderbird-cur.tar.gz thunderbird-old.tar.gz
tar -cf thunderbird-cur.tar /home/ian/.mozilla-thunderbird/*
gzip firefox-cur.tar



Should do the job I think, make a shell script with that in it, as for running it when you shutdown/log off, guessing ubuntu uses some init-script type things that you can use to achieve that.

As a cron job it would only run at a set time/day, which would be fine but not quite to requirements :p
 
cool thanks, will give it a try.
I have been poking around on the Ubuntu forums and havent yet found what i want but im sure its there. :)
 
somthing cannot beworking right as i get this output
Code:
$ sh backup.sh
tar: Removing leading `/' from member names
gzip: firefox-cur.tar.gz: Operation not permitted
gzip: firefox-cur.tar.gz: Operation not permitted
tar: Removing leading `/' from member names
gzip: thunderbird-cur.tar.gz: Operation not permitted
gzip: thunderbird-cur.tar.gz: Operation not permitted
ian@ian-desktop:~/Desktop$

but it does create the gz files
 
BigBoy said:
somthing cannot beworking right as i get this output
Code:
$ sh backup.sh
tar: Removing leading `/' from member names
gzip: firefox-cur.tar.gz: Operation not permitted
gzip: firefox-cur.tar.gz: Operation not permitted
tar: Removing leading `/' from member names
gzip: thunderbird-cur.tar.gz: Operation not permitted
gzip: thunderbird-cur.tar.gz: Operation not permitted
ian@ian-desktop:~/Desktop$

but it does create the gz files

Just tried it, I get the warnings from tar, although it does create the correct tar file, gzip however works without a problem for me?

I'll have a quick look into how to get rid of the tar warnings, shouldn't be too hard,

might be worth trying the -v flag for gzip to see if it gives any more info...
 
Code:
ian@ian-desktop:~/Desktop$ sh -v backup.sh
cd /media/hdb1/Backup

mv firefox-cur.tar.gz firefox-old.tar.gz
tar -cf firefox-cur.tar /home/ian/.mozilla/firefox/*
tar: Removing leading `/' from member names
gzip -f -v firefox-cur.tar
firefox-cur.tar:        gzip: firefox-cur.tar.gz: Operation not permitted
gzip: firefox-cur.tar.gz: Operation not permitted
 27.9% -- replaced with firefox-cur.tar.gz

mv thunderbird-cur.tar.gz thunderbird-old.tar.gz
tar -cf thunderbird-cur.tar /home/ian/.mozilla-thunderbird/*
tar: Removing leading `/' from member names
gzip -f -v thunderbird-cur.tar
thunderbird-cur.tar:    gzip: thunderbird-cur.tar.gz: Operation not permitted
gzip: thunderbird-cur.tar.gz: Operation not permitted
 39.7% -- replaced with thunderbird-cur.tar.gz

ian@ian-desktop:~/Desktop$

With the -v option
 
Back
Top Bottom