LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-05-2017, 04:27 PM   #16
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Brú na Bóinne, IE
Distribution: Slackware, NetBSD
Posts: 1,555

Rep: Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027

Quote:
Originally Posted by maschelsea View Post
OK. I've changed my tar command to
Code:
tar -c -v --bzip2 --file=$filename  --files-from=/home/iNew_list --exclude="$seamonkey/places.sqlite" --exclude="$seamonkey/netpredictions.sqlite" ...
You aren't closing the quotes properly. I have added a couple to show you. You're also being careless with the = sign; sometimes you add it, sometimes you don't. A backup script shouldn't be this haphazard. It would be a lot tidier and more manageable, for starters, if you put your exclude patterns in a file instead, and used the --exclude-from switch.

For example:
Code:
--exclude-from=exclusions.lst
Excerpt from exclusions.lst file:
Code:
/home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite
/home/michael/.mozilla/seamonkey/ulz2b39j.default/netpredictions.sqlite

Last edited by Gerard Lally; 05-05-2017 at 04:38 PM.
 
1 members found this post helpful.
Old 05-05-2017, 04:38 PM   #17
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 993

Rep: Reputation: 127Reputation: 127
Is the backslash at the top correct?
Code:
\#!/bin/sh
 
Old 05-05-2017, 05:09 PM   #18
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Brú na Bóinne, IE
Distribution: Slackware, NetBSD
Posts: 1,555

Rep: Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027
Quote:
Originally Posted by Pearlseattle View Post
Sorry, could you pls. give 1 example of which file listed by your output of "tar" is not supposed to be there thanks to one of the exclude-parameters?
Did some random checks and I could not find anything... (or I have misunderstood the question or did not search correctly...).
seamonkey places.sqlite and places.sqlite-wal, for starters.
 
Old 05-06-2017, 12:10 AM   #19
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.2
Posts: 3,314

Rep: Reputation: 1666Reputation: 1666Reputation: 1666Reputation: 1666Reputation: 1666Reputation: 1666Reputation: 1666Reputation: 1666Reputation: 1666Reputation: 1666Reputation: 1666
Quote:
Originally Posted by Alien Bob View Post
I'm sorry, but you do not back your claim that this is a bad backup script. Therefore your answer is useless. Tell the OP what is wrong with the script if you think it can be done better.
Also, what's wrong with a script being "distribution neutral"?
My first thought while reading the script was why not use the find command to provide the correct list of files versus using a mix of find, sed, and then tar to massage the file list? If for some reason find cannot do the right thing all by itself, then a find/grep combination should be able to give tar just the list that it needs.

My second thought was that there is probably a difference between either or both of:
  1. The versions of bash between Gentoo and Slackware.
  2. The versions of tar between Gentoo and Slackware.
 
Old 05-06-2017, 09:33 AM   #20
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
I don't know what that means.
 
Old 05-06-2017, 09:37 AM   #21
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
Code:
root@caitlyn:~# tar tvjf /backup/caitlyn/201705/caitlyn-slackware-michael-20170506.tar.bz2
-rw------- michael/users 21067 2017-05-05 15:49 home/michael/.local/share/recently-used.xbel
-rw------- michael/users 130037 2017-05-05 15:56 home/michael/.mozilla/seamonkey/ulz2b39j.default/logins.json
-rw-r--r-- michael/users   8972 2017-05-05 17:03 home/michael/.mozilla/seamonkey/ulz2b39j.default/SiteSecurityServiceState.txt
-rw-r--r-- michael/users 524288 2017-05-05 18:04 home/michael/.mozilla/seamonkey/ulz2b39j.default/cookies.sqlite
-rw------- michael/users 5738574 2017-05-05 23:22 home/michael/.mozilla/seamonkey/ulz2b39j.default/adblockplus/patterns.ini
-rw------- michael/users 5738551 2017-05-05 19:22 home/michael/.mozilla/seamonkey/ulz2b39j.default/adblockplus/patterns-backup1.ini
-rw-r--r-- michael/users   32768 2017-05-05 19:36 home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite-shm
-rw------- michael/users   61989 2017-05-05 19:25 home/michael/.mozilla/seamonkey/ulz2b39j.default/extensions.json
-rw------- michael/users   44815 2017-05-05 23:23 home/michael/.mozilla/seamonkey/ulz2b39j.default/prefs.js
-rw-r--r-- michael/users 1180544 2017-05-05 19:36 home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite-wal
-rw-r--r-- michael/users 1409024 2017-05-05 09:53 home/michael/.mozilla/seamonkey/ulz2b39j.default/webappsstore.sqlite
-rw-r--r-- michael/users   17408 2017-05-05 15:56 home/michael/.mozilla/seamonkey/ulz2b39j.default/urlbarhistory.sqlite
-rw------- michael/users   33791 2017-05-05 16:14 home/michael/.mozilla/seamonkey/ulz2b39j.default/sessionstore.json
-rw-r--r-- michael/users 1147752 2017-05-05 11:30 home/michael/.mozilla/seamonkey/ulz2b39j.default/webappsstore.sqlite-wal
-rw-r--r-- michael/users   32768 2017-05-05 21:29 home/michael/.mozilla/seamonkey/ulz2b39j.default/cookies.sqlite-shm
-rw-r--r-- michael/users  721456 2017-05-05 21:29 home/michael/.mozilla/seamonkey/ulz2b39j.default/cookies.sqlite-wal
-rw-r--r-- michael/users   57344 2017-05-05 19:36 home/michael/.mozilla/seamonkey/ulz2b39j.default/storage/default/https+++weather.com/idb/2293386553%B430%tcw.sqlite
-rw-r--r-- michael/users   32768 2017-05-05 11:37 home/michael/.mozilla/seamonkey/ulz2b39j.default/webappsstore.sqlite-shm
-rw-r--r-- michael/users 10485760 2017-05-05 19:36 home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite
-rw-r--r-- michael/users   417792 2017-05-05 15:56 home/michael/.mozilla/seamonkey/ulz2b39j.default/formhistory.sqlite
-rw------- michael/users   247133 2017-05-05 23:53 home/michael/.xsession-errors
-rw-r--r-- michael/users    87150 2017-05-05 15:49 home/michael/Checkbook.gnumeric
-rw-r--r-- michael/users    16734 2017-05-05 16:01 home/michael/.config/dconf/user
-rw-r--r-- michael/users    26148 2017-05-05 13:24 home/michael/.xfce4-session.verbose-log
-rw-r--r-- michael/users    71175 2017-05-05 11:42 home/michael/.thunderbird/9r1hh5rz.default/history.mab
-rw-r--r-- michael/users     2277 2017-05-05 10:56 home/michael/.thunderbird/9r1hh5rz.default/SiteSecurityServiceState.txt
-rw-r--r-- michael/users   524288 2017-05-05 16:15 home/michael/.thunderbird/9r1hh5rz.default/cookies.sqlite
-rw-r--r-- michael/users    32768 2017-05-05 19:36 home/michael/.thunderbird/9r1hh5rz.default/places.sqlite-shm
-rw------- michael/users     3436 2017-05-05 19:27 home/michael/.thunderbird/9r1hh5rz.default/extensions.json
-rw-r--r-- michael/users    19934 2017-05-05 19:36 home/michael/.thunderbird/9r1hh5rz.default/prefs.js
-rw-r--r-- michael/users   655872 2017-05-05 19:36 home/michael/.thunderbird/9r1hh5rz.default/places.sqlite-wal
-rw-r--r-- michael/users    32768 2017-05-05 19:31 home/michael/.thunderbird/9r1hh5rz.default/cookies.sqlite-shm
-rw-r--r-- michael/users   721456 2017-05-05 19:31 home/michael/.thunderbird/9r1hh5rz.default/cookies.sqlite-wal
-rw-r--r-- michael/users 188612608 2017-05-05 16:20 home/michael/.thunderbird/9r1hh5rz.default/global-messages-db.sqlite
-rw-r--r-- michael/users   2588672 2017-05-05 19:36 home/michael/.thunderbird/9r1hh5rz.default/places.sqlite
-rw------- michael/users       397 2017-05-05 16:20 home/michael/.thunderbird/9r1hh5rz.default/session.json
-rw------- michael/users      5555 2017-05-05 11:43 home/michael/.thunderbird/9r1hh5rz.default/xulstore.json
-rwx------ michael/users      1663 2017-05-05 16:09 home/michael/system/dBackup~
-rwx------ michael/users    210639 2017-05-05 16:12 home/michael/system/.dBackup.un~
-rwx------ michael/users      1675 2017-05-05 16:12 home/michael/system/dBackup
-rw------- michael/users     23059 2017-05-05 16:12 home/michael/.viminfo
You'll notice that several files that were marked to be excluded still manage to exist in the archive. Why do they still exist?
 
Old 05-06-2017, 09:39 AM   #22
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
To Pearlseattle, I don't see a backslash at the top of my script:
Code:
michael@caitlyn ~ $ head system/dBackup
#!/bin/sh
hostname="caitlyn"

if [ -d /home/michael/.Trash ]; then
   rm -r /home/michael/.Trash
fi

if [ -d /home/amy/.Trash ]; then
   rm -r /home/amy/.Trash
fi
michael@caitlyn ~ $
 
Old 05-07-2017, 10:30 AM   #23
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
To Richard Cranium:

I keep an updated copy of a Gentoo installation on a thumb drive, just in case I ever have problems booting into Slackware. I've only had to use it once, when I wanted to resize a partition on my single installed hard drive, and couldn't use gparted from within Slackware because the drive was currently mounted. I update both Slackware and the Gentoo drive every Sunday. I just checked the current version of bash and tar on both systems. The tar version is exactly the same - 1.29. The bash version is NEWER on Slackware than it is on Gentoo:

Gentoo:
Code:
root@caitlyn:~# chroot /mnt/gentoo/
caitlyn / # bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Slackware:
Code:
michael@caitlyn ~ $ bash --version
GNU bash, version 4.4.5(1)-release (x86_64-slackware-linux-gnu)
So I don't think it's a version difference problem.
 
Old 05-07-2017, 10:50 AM   #24
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Gerard Lally View Post
You aren't closing the quotes properly. I have added a couple to show you. You're also being careless with the = sign; sometimes you add it, sometimes you don't. A backup script shouldn't be this haphazard. It would be a lot tidier and more manageable, for starters, if you put your exclude patterns in a file instead, and used the --exclude-from switch.

For example:
Code:
--exclude-from=exclusions.lst
Excerpt from exclusions.lst file:
Code:
/home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite
/home/michael/.mozilla/seamonkey/ulz2b39j.default/netpredictions.sqlite
You are very right. I didn't even notice that my double quotes use was inconsistent. I relocated my exclude list to a file in the system directory called excludes.lst. I've implemented your --exclude-from solution. Tomorrow we'll see if it works as well as I expect it to. I think it will. It makes logical sense.
 
Old 05-08-2017, 09:38 AM   #25
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
OK. I implemented the --excludes-from solution yesterday. Here are my results:

Code:
michael@caitlyn ~ $ cat system/dBackup
#!/bin/sh
hostname="caitlyn"

if [ -d /home/michael/.Trash ]; then
   rm -r /home/michael/.Trash
fi

if [ -d /home/amy/.Trash ]; then
   rm -r /home/amy/.Trash
fi
today=`date '+%Y%m%d'`
monthyear=`date '+%Y%m'`
seamonkey="/home/michael/.mozilla/seamonkey/ulz2b39j.default"
thunderbird="/home/michael/.thunderbird/9r1hh5rz.default/"
# Home section
filename=/backup/$hostname/$monthyear/$hostname-slackware-michael-$today.tar.bz2
find /home/michael -daystart -type f -mtime 1 > /home/iBackup_list
cat /home/iBackup_list | sed '/ache/ d' | sed '/mail/ d' | sed '/pan/ d' > /home/iNew_list
tar -c -v --bzip2 --file=$filename  --files-from=/home/iNew_list --exclude-from=/home/michael/system/excludes.lst

#tar -c -v --bzip2 --file=$filename  --files-from=/home/iNew_list --exclude="$seamonkey/places.sqlite --exclude $seamonkey/netpredictions.sqlite" --exclude="$thunderbird/global-messages-db.sqlite --exclude $seamonkey/places.sqlite-wal" --exclude="$seamonkey/cookies.sqlite" --exclude "$thunderbird/places.sqlite" --exclude="$thunderbird/places.sqlite-wal" --exclude="$seamonkey/webappsstore.sqlite" --exclude="/home/michael/.mythtv/*" --exclude="/home/michael/.local/*" --exclude="/home/michael/.xsession-errors" --exclude="/home/michael/.macromedia/*" --exclude="/home/michael/.viminfo" --exclude="/home/michael/.config/*" --exclude="/home/michael/.bash*" --exclude="/home/michael/.gstreamer*" --exclude="/home/michael/.dbus/*" --exclude="/home/michael/.freeciv/*" --exclude="/home/michael/.Skype/*" --exclude="/home/michael/.thumbnails/*"

filename=/backup/$hostname/$monthyear/$hostname-slackware-etc-$today.tar.bz2
find /etc  -daystart -type f -mtime 1 > /home/iBackup_list
tar -c -v --bzip2 --file=$filename  --files-from=/home/iBackup_list
 
rm /home/iNew_list
rm /home/iBackup_list

michael@caitlyn ~ $ cat system/excludes.lst 
/home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite 
/home/michael/.mozilla/seamonkey/ulz2b39j.default/netpredictions.sqlite 
/home/michael/.thunderbird/9r1hh5rz.defaultglobal-messages-db.sqlite 
/home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite-wal 
/home/michael/.mozilla/seamonkey/ulz2b39j.default/cookies.sqlite
/home/michael/.thunderbird/9r1hh5rz.defaultplaces.sqlite 
/home/michael/.thunderbird/9r1hh5rz.defaultplaces.sqlite-wal
/home/michael/.mozilla/seamonkey/ulz2b39j.default/webappsstore.sqlite 
/home/michael/.mythtv/* 
/home/michael/.local/* 
/home/michael/.xsession-errors
/home/michael/.macromedia/*
/home/michael/.viminfo
/home/michael/.config/*
/home/michael/.bash* 
/home/michael/.gstreamer*
/home/michael/.dbus/*
/home/michael/.freeciv/* 
/home/michael/.Skype/*
/home/michael/.thumbnails/*"
I DID have to delete a few files from the backup archive c/home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite-walreated this morning, but it was far smaller than I was expecting. Among the files I manually deleted where ~/.local and ~/.config as well as /home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite and /home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite-wal. Can any of you see the reason why these files were still in the archive?
 
1 members found this post helpful.
Old 05-08-2017, 10:41 AM   #26
55020
Senior Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Blog Entries: 4

Rep: Reputation: Disabled
If that's an exact verbatim paste, most (but not all) of the lines in your excludes.lst file appear to have a trailing space.
 
2 members found this post helpful.
Old 05-08-2017, 10:48 AM   #27
gegechris99
Member
 
Registered: Oct 2005
Location: France
Distribution: Slackware 14.2 64bit
Posts: 915
Blog Entries: 5

Rep: Reputation: 145Reputation: 145
You have also some missing slashes "/" for thunderbird files and a double-quote at the end.

Quote:
michael@caitlyn ~ $ cat system/excludes.lst
/home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite
/home/michael/.mozilla/seamonkey/ulz2b39j.default/netpredictions.sqlite
/home/michael/.thunderbird/9r1hh5rz.default/global-messages-db.sqlite
/home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite-wal
/home/michael/.mozilla/seamonkey/ulz2b39j.default/cookies.sqlite
/home/michael/.thunderbird/9r1hh5rz.default/places.sqlite
/home/michael/.thunderbird/9r1hh5rz.default/places.sqlite-wal
/home/michael/.mozilla/seamonkey/ulz2b39j.default/webappsstore.sqlite
/home/michael/.mythtv/*
/home/michael/.local/*
/home/michael/.xsession-errors
/home/michael/.macromedia/*
/home/michael/.viminfo
/home/michael/.config/*
/home/michael/.bash*
/home/michael/.gstreamer*
/home/michael/.dbus/*
/home/michael/.freeciv/*
/home/michael/.Skype/*
/home/michael/.thumbnails/*"
 
2 members found this post helpful.
Old 05-08-2017, 01:59 PM   #28
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by gegechris99 View Post
You have also some missing slashes "/" for thunderbird files and a double-quote at the end.
I corrected the thunderbird slashes and removed the " at the end of the .thumbnails line. The funny thing is that I didn't have to manually delete anything from the .thunderbird directory in the archive this morning...
 
Old 05-08-2017, 02:13 PM   #29
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Brú na Bóinne, IE
Distribution: Slackware, NetBSD
Posts: 1,555

Rep: Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027Reputation: 1027
Quote:
Originally Posted by maschelsea View Post
I corrected the thunderbird slashes and removed the " at the end of the .thumbnails line. The funny thing is that I didn't have to manually delete anything from the .thunderbird directory in the archive this morning...
It's just as important to remove any trailing whitespace at the end of a line, as David pointed out above.

In Vim, type this:
Code:
:%s/\s\+$//
From the tar documentation:

Quote:
Notice, that lines from file are read verbatim. One of the frequent errors is leaving some extra whitespace after a file name, which is difficult to catch using text editors.

Last edited by Gerard Lally; 05-08-2017 at 02:29 PM.
 
Old 05-08-2017, 04:04 PM   #30
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
I removed one or two spaces from my dBackup script.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Easy Linux backups with Lucky Backup LXer Syndicated Linux News 0 06-29-2010 12:41 PM
Mount an ISO made with dd if=/dev/sda2 of=/backups/backup.iso pcsousa Linux - Newbie 8 02-26-2010 06:33 PM
what's your recommendation re backup scripts (shell or ruby) for linux backups??? callagga Linux - Newbie 8 07-13-2008 02:04 AM
Online backup manager: missing scheduled backups ronaldv Ubuntu 0 11-08-2007 02:14 PM
Rsync backups - how not to backup TV recordings jamespetts Linux - Software 0 11-20-2004 12:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration