Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1802
  • Last Modified:

How to backup multiple users' history.dat file

Gday,

I would like to be able to backup multiple users' history.dat files in their firefox profile folder. The file is found in:

/home/<user>/.mozilla/firefox/<random>.profile/history.dat

The problem is that there are two variables that change in the file path on a per user basis. The first is the username and the second is the <random> part of the profile.

cp /home/*/.mozilla/firefox/*/history.dat /dest/directory

The above command seems to work fine with the wildcards, however it runs in to a problem after the first history.dat file gets backed and complains about overwriting the existing file. Obviously I can force the overwrite but that would leave me with only one file.

Is there any way I can append the username to the file and back it up through something like rsync to a NAS.

i.e. history.dat_user1, history.dat_user2

I would like to do this daily and overwrite the files so only the latest copy of the history file is archived.

Cheers
0
subz0r69z0r
Asked:
subz0r69z0r
  • 2
  • 2
1 Solution
 
ygouthamCommented:
a simple bash script would do the trick


#!/bin/bash
 
namelist=`ls /home/`
 
for userdir in $namelist
 
do
 
cp /home/$userdir/.mozilla/firefox/*.profile/history.dat /dest/directory/$userdir.history.dat
 
done

Open in new window

0
 
subz0r69z0rAuthor Commented:
Thanks!

I modified the script to use rsync and to mount and unmount a NAS drive. Just a quick note that *.profile did not work, I had to change it to *.

Cheers
0
 
subz0r69z0rAuthor Commented:
thanks mate
0
 
ygouthamCommented:
great!  it worked on my fedora 7 box.  did not think of checking up with what flavor you had.  good luck in any case.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now