LinuxQuestions.org
Review your favorite Linux distribution.
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-04-2017, 10:34 AM   #1
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Rep: Reputation: Disabled
Backups and backup maintenance


I am posting this here because this command worked correctly when I used Gentoo. I switched over to Slack last December, and now it doesn't work.

Cron is set to make a full backup of /etc and /home on the 1st of every month, and a backup of the files that have changed every day. This way if I need to restore, I just extract the full backup and then every partial backup since the full backup was made. This solution has worked for me since 2005. Every three months, I write the previous quarter's backups to a DVD. Hence, it's rather important that I keep my backups as small as possible so that three months can fit on a single disc.

My dBackup backup script is:
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 $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 ~ $
As I said earlier, when I was running Gentoo, this script worked exactly as expected. In Slackware, it doesn't. Every morning I run my daily-backup script, which loads the day's archive and I check it to make sure that no unnecessary files are in the archive. And every day there are files I have to manually delete that are listed up there to --exclude. Why does this not work on Slackware?
 
Old 05-04-2017, 10:44 AM   #2
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
Allow me to offer a solution to my own problem. I did not realize until just now, but I had '--exclude' mixed with '--exclude='. I changed all the '--exclude' to 'exclude=' and it seems to work.
 
Old 05-05-2017, 09:48 AM   #3
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
I thought this was solved, but my backup today told me different.

Code:
root@caitlyn:~# tar tvjf /backup/caitlyn/201705/caitlyn-slackware-michael-20170505.tar.bz2
-rw-r--r-- michael/users 116934237 2017-05-04 17:42 home/michael/wetransfer-491fe9.zip
-rw------- michael/users     56716 2017-05-04 19:27 home/michael/.mozilla/seamonkey/ulz2b39j.default/addons.json
-rw------- michael/users    130037 2017-05-04 10:02 home/michael/.mozilla/seamonkey/ulz2b39j.default/logins.json
-rw-r--r-- michael/users      8971 2017-05-04 23:31 home/michael/.mozilla/seamonkey/ulz2b39j.default/SiteSecurityServiceState.txt
-rw-r--r-- michael/users    524288 2017-05-04 23:58 home/michael/.mozilla/seamonkey/ulz2b39j.default/cookies.sqlite
-rw------- michael/users   5736789 2017-05-04 23:22 home/michael/.mozilla/seamonkey/ulz2b39j.default/adblockplus/patterns.ini
-rw------- michael/users   5736789 2017-05-04 19:22 home/michael/.mozilla/seamonkey/ulz2b39j.default/adblockplus/patterns-backup1.ini
-rw-r--r-- michael/users     32768 2017-05-04 19:36 home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite-shm
-rw------- michael/users     61989 2017-05-04 19:25 home/michael/.mozilla/seamonkey/ulz2b39j.default/extensions.json
-rw------- michael/users     44984 2017-05-04 23:23 home/michael/.mozilla/seamonkey/ulz2b39j.default/prefs.js
-rw-r--r-- michael/users   4164616 2017-05-04 19:36 home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite-wal
-rw-r--r-- michael/users   1409024 2017-05-04 17:41 home/michael/.mozilla/seamonkey/ulz2b39j.default/webappsstore.sqlite
-rw------- michael/users    242506 2017-05-04 19:29 home/michael/.mozilla/seamonkey/ulz2b39j.default/blocklist.xml
-rw-r--r-- michael/users    819200 2017-05-04 17:41 home/michael/.mozilla/seamonkey/ulz2b39j.default/content-prefs.sqlite
-rw-r--r-- michael/users     17408 2017-05-04 10:45 home/michael/.mozilla/seamonkey/ulz2b39j.default/urlbarhistory.sqlite
-rw------- michael/users     37403 2017-05-04 17:42 home/michael/.mozilla/seamonkey/ulz2b39j.default/sessionstore.json
-rw-r--r-- michael/users   1147752 2017-05-04 17:41 home/michael/.mozilla/seamonkey/ulz2b39j.default/webappsstore.sqlite-wal
-rw-r--r-- michael/users     32768 2017-05-04 23:58 home/michael/.mozilla/seamonkey/ulz2b39j.default/cookies.sqlite-shm
-rw-r--r-- michael/users    721456 2017-05-04 23:58 home/michael/.mozilla/seamonkey/ulz2b39j.default/cookies.sqlite-wal
-rw-r--r-- michael/users     32768 2017-05-04 17:41 home/michael/.mozilla/seamonkey/ulz2b39j.default/webappsstore.sqlite-shm
-rw-r--r-- michael/users  10485760 2017-05-04 19:36 home/michael/.mozilla/seamonkey/ulz2b39j.default/places.sqlite
-rw-r--r-- michael/users    417792 2017-05-04 19:36 home/michael/.mozilla/seamonkey/ulz2b39j.default/formhistory.sqlite
-rw-r--r-- michael/users    814080 2017-05-04 17:42 home/michael/.mozilla/seamonkey/ulz2b39j.default/downloads.sqlite
-rw-r--r-- michael/users     87066 2017-05-04 19:32 home/michael/Checkbook.gnumeric
-rw------- michael/users      3965 2017-05-04 19:29 home/michael/.thunderbird/9r1hh5rz.default/addons.json
-rw-r--r-- michael/users     70377 2017-05-04 10:09 home/michael/.thunderbird/9r1hh5rz.default/history.mab
-rw-r--r-- michael/users      2277 2017-05-04 19:36 home/michael/.thunderbird/9r1hh5rz.default/SiteSecurityServiceState.txt
-rw-r--r-- michael/users    524288 2017-05-04 17:41 home/michael/.thunderbird/9r1hh5rz.default/cookies.sqlite
-rw-r--r-- michael/users     32768 2017-05-04 19:36 home/michael/.thunderbird/9r1hh5rz.default/places.sqlite-shm
-rw------- michael/users      3436 2017-05-04 19:27 home/michael/.thunderbird/9r1hh5rz.default/extensions.json
-rw-r--r-- michael/users     19889 2017-05-04 19:36 home/michael/.thunderbird/9r1hh5rz.default/prefs.js
-rw-r--r-- michael/users    655872 2017-05-04 19:36 home/michael/.thunderbird/9r1hh5rz.default/places.sqlite-wal
-rw-r--r-- michael/users     23240 2017-05-04 13:20 home/michael/.thunderbird/9r1hh5rz.default/abook.mab
-rw------- michael/users    227240 2017-05-04 19:31 home/michael/.thunderbird/9r1hh5rz.default/blocklist.xml
-rw-r--r-- michael/users     32768 2017-05-04 19:31 home/michael/.thunderbird/9r1hh5rz.default/cookies.sqlite-shm
-rw-r--r-- michael/users    721456 2017-05-04 19:31 home/michael/.thunderbird/9r1hh5rz.default/cookies.sqlite-wal
-rw-r--r-- michael/users 188612608 2017-05-04 23:49 home/michael/.thunderbird/9r1hh5rz.default/global-messages-db.sqlite
-rw-r--r-- michael/users   2588672 2017-05-04 19:36 home/michael/.thunderbird/9r1hh5rz.default/places.sqlite
-rw------- michael/users       397 2017-05-04 10:25 home/michael/.thunderbird/9r1hh5rz.default/session.json
-rw------- michael/users     47438 2017-05-04 19:31 home/michael/.thunderbird/9r1hh5rz.default/downloads.json
-rw-r--r-- michael/users   1399547 2017-05-04 19:31 home/michael/Better Off Flipping the Switch on  Technology (P.S.) by Eric Brende.pdf
-rwx------ michael/users    190926 2017-05-04 10:44 home/michael/system/.dBackup.un~
-rwx------ michael/users      1663 2017-05-04 10:44 home/michael/system/dBackup
-rw-r--r-- michael/users   2484176 2017-05-04 19:31 home/michael/Instructables.com, Noah  Weinstein-Projects to Get You Off the Grid_ Rain Barrels, Chicken Coops,  and Solar Panels.pdf
root@caitlyn:~#
Please help. Is there a way to get rid of these unwanted files automatically?
 
Old 05-05-2017, 03:11 PM   #4
sramov
Member
 
Registered: Mar 2010
Distribution: slackware64-current
Posts: 31

Rep: Reputation: Disabled
I'm sorry, but this has to be the worst backup script I've seen to date.

You seem to be quite familiar to shell scripting so my advice is to figure it out on your own as it seems quite convoluted, not to mention distribution neutral.
 
Old 05-05-2017, 03:20 PM   #5
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 7,587

Rep: Reputation: 5999Reputation: 5999Reputation: 5999Reputation: 5999Reputation: 5999Reputation: 5999Reputation: 5999Reputation: 5999Reputation: 5999Reputation: 5999Reputation: 5999
Quote:
Originally Posted by sramov View Post
I'm sorry, but this has to be the worst backup script I've seen to date.

You seem to be quite familiar to shell scripting so my advice is to figure it out on your own as it seems quite convoluted, not to mention distribution neutral.
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"?
 
Old 05-05-2017, 03:23 PM   #6
sramov
Member
 
Registered: Mar 2010
Distribution: slackware64-current
Posts: 31

Rep: Reputation: Disabled
Quote:
Originally Posted by Alien Bob View Post
Also, what's wrong with a script being "distribution neutral"?
Nothing, quite the opposite, which is why I think this doesn't belong to a Slackware sub-forum.
 
Old 05-05-2017, 03:32 PM   #7
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 8,879

Rep: Reputation: Disabled
Quote:
Originally Posted by sramov View Post
Nothing, quite the opposite, which is why I think this doesn't belong to a Slackware sub-forum.
Highlight mine:
Quote:
Originally Posted by maschelsea View Post
I am posting this here because this command worked correctly when I used Gentoo. I switched over to Slack last December, and now it doesn't work.
 
Old 05-05-2017, 03:41 PM   #8
sramov
Member
 
Registered: Mar 2010
Distribution: slackware64-current
Posts: 31

Rep: Reputation: Disabled
Quote:
Originally Posted by Didier Spaier View Post
Highlight mine:
Which is applicable basically to any distribution in existence.

OP didn't even provide the basic troubleshooting steps/results/error messages.
 
Old 05-05-2017, 03:52 PM   #9
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 993

Rep: Reputation: 127Reputation: 127
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...).
 
Old 05-05-2017, 04:01 PM   #10
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
Try double quotes, and I would say put them in the tar command. For example:
Code:
seamonkey="/home/michael/.mozilla/seamonkey/ulz2b39j.default"
tar -c -v --bzip2 --file=$filename  --files-from=/home/iNew_list --exclude="$seamonkey/places.sqlite" ...

Last edited by Gerard Lally; 05-05-2017 at 06:17 PM.
 
Old 05-05-2017, 04:02 PM   #11
sramov
Member
 
Registered: Mar 2010
Distribution: slackware64-current
Posts: 31

Rep: Reputation: Disabled
'Doesn't work in Slackware' is all we got, hence my replies.
 
Old 05-05-2017, 04:04 PM   #12
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
I believe I said that this script has worked well since 2005 when I started using Gentoo. I am not overly familiar with shell scripting. At the time I hacked together this script I was familiar, but that was years ago. At the time, I was supervising maintenance on three different computers. Now I am running one. And I need this to be distribution neutral. I am using Slackware now, but in a few years I may decide that Slackware no longer works for what I am interested in at the time, so I want all my scripts to move as seamlessly as possible to whatever new distro I switch to.
 
Old 05-05-2017, 04:06 PM   #13
sramov
Member
 
Registered: Mar 2010
Distribution: slackware64-current
Posts: 31

Rep: Reputation: Disabled
http://www.catb.org/esr/faqs/smart-questions.html
 
Old 05-05-2017, 04:11 PM   #14
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 325

Original Poster
Rep: Reputation: Disabled
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" --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/*"
I'll wait until the script runs tonight at midnight CDT and I'll write in tomorrow.
 
Old 05-05-2017, 04:17 PM   #15
sramov
Member
 
Registered: Mar 2010
Distribution: slackware64-current
Posts: 31

Rep: Reputation: Disabled
Let's just hope for the best eh? Turtles all the way down.
 
  


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 01:00 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