Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to backup multiple users' history.dat file

Posted on 2008-06-15
4
Medium Priority
?
1,798 Views
Last Modified: 2013-12-07
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
Comment
Question by:subz0r69z0r
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
ygoutham earned 2000 total points
ID: 21791839
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
 

Author Comment

by:subz0r69z0r
ID: 21798712
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
 

Author Closing Comment

by:subz0r69z0r
ID: 31467434
thanks mate
0
 
LVL 14

Expert Comment

by:ygoutham
ID: 21800174
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question