Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
backupninja
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raT
backupninja
Commits
d3875324
Commit
d3875324
authored
Apr 12, 2006
by
micah
Browse files
Options
Downloads
Patches
Plain Diff
Added tar handler
parent
ea111f2a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ChangeLog
+1
-0
1 addition, 0 deletions
ChangeLog
handlers/tar
+79
-0
79 additions, 0 deletions
handlers/tar
handlers/tar.helper
+94
-0
94 additions, 0 deletions
handlers/tar.helper
with
174 additions
and
0 deletions
ChangeLog
+
1
−
0
View file @
d3875324
...
@@ -2,6 +2,7 @@ version 0.9.4 -- unreleased
...
@@ -2,6 +2,7 @@ version 0.9.4 -- unreleased
backupninja changes
backupninja changes
Recursively ignore subdirs in /etc/backup.d (Closes: #361102)
Recursively ignore subdirs in /etc/backup.d (Closes: #361102)
handler changes
handler changes
Added tar handler
mysql:
mysql:
. Fixed improper use of $vuserhome (Debian: #351083)
. Fixed improper use of $vuserhome (Debian: #351083)
. Fixed erroneous removal of tmpfile when it didn't exit
. Fixed erroneous removal of tmpfile when it didn't exit
...
...
This diff is collapsed.
Click to expand it.
handlers/tar
0 → 100644
+
79
−
0
View file @
d3875324
# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
#
# tar handler script for backupninja
getconf backupname
`
hostname
--fqdn
`
getconf backupdir /var/backups/
`
hostname
--fqdn
`
getconf compress bzip
getconf includes
"/etc /home /usr/local"
getconf excludes
"/tmp /proc /dev /sys /net /misc /media /srv /selinux"
getconf TAR
`
which
tar
`
getconf EXTENSION
tar
getconf DATE
`
which
date
`
getconf DATEFORMAT
"%Y.%m.%d-%H%M"
# See if vservers are configured
if
[
"
$vservers
"
=
"yes"
]
then
warning
"vservers enabled, but tar does not support it!"
fi
if
[
!
-d
"
$backupdir
"
]
then
mkdir
-p
"
$backupdir
"
||
fatal
"Can not make directory
$backupdir
"
fi
if
[
!
-w
"
$backupdir
"
]
then
fatal
"Directory
$backupdir
is not writable"
fi
## DO IT #################################################
#
# here we grab a list of the packages installed and removed.
#
case
$compress
in
"compress"
)
compress_option
=
"-Z"
EXTENSION
=
"tar.compress"
;;
"gzip"
)
compress_option
=
"-z"
EXTENSION
=
"tgz"
;;
"bzip"
)
compress_option
=
"-j"
EXTENSION
=
"tar.bz2"
;;
"none"
)
compress_option
=
""
;;
*
)
warning
"Unknown compress filter (
$tar_compress
)"
compress_option
=
""
EXTENSION
=
"tgz"
;;
esac
exclude_options
=
""
for
i
in
$excludes
do
exclude_options
=
"
$exclude_options
--exclude
$i
"
done
debug
"Running backup: "
$TAR
-c
-p
-v
$compress_option
$exclude_options
\
-f
"
$backupdir
/
$backupname
-"
`
$DATE
"+
$DATEFORMAT
"
`
".
$EXTENSION
"
\
$includes
$TAR
-c
-p
-v
$compress_option
$exclude_options
\
-f
"
$backupdir
/
$backupname
-"
`
$DATE
"+
$DATEFORMAT
"
`
".
$EXTENSION
"
\
$includes
\
>
"
$backupdir
/
$backupname
-"
`
$DATE
"+
$DATEFORMAT
"
`
.list
\
2>
"
$backupdir
/
$backupname
-"
`
$DATE
"+
$DATEFORMAT
"
`
.err
[
$?
-ne
0
]
&&
fatal
"Tar backup failed"
This diff is collapsed.
Click to expand it.
handlers/tar.helper
0 → 100644
+
94
−
0
View file @
d3875324
# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
HELPERS
=
"
$HELPERS
tar:tar_backup"
tar_wizard
()
{
tar_title
=
"Tar action wizard"
backupname
=
`
hostname
--fqdn
`
inputBox
"
$tar_title
"
"When to run this action?"
"everyday at 01"
[
$?
=
1
]
&&
return
tar_when_run
=
"when =
$REPLY
"
inputBox
"
$tar_title
"
"
\"
Name
\"
of backups"
"
$backupname
"
[
$?
=
1
]
&&
return
tar_backupname
=
"backupname =
$REPLY
"
backupname
=
"
$REPLY
"
inputBox
"
$tar_title
"
"Directory where to store the backups"
"/net/backups/
$backupname
"
[
$?
=
1
]
&&
return
tar_backupdir
=
"backupdir =
$REPLY
"
radioBox
"
$tar_title
"
"Compression"
\
"none"
"do not filter trough"
off
\
"compress"
"filter trough compress"
off
\
"gzip"
"filter trough gzip"
off
\
"bzip"
"filter trough bzip"
on
[
$?
=
1
]
&&
return
;
result
=
"
$REPLY
"
tar_compress
=
"compress =
$REPLY
"
REPLY
=
while
[
-z
"
$REPLY
"
]
;
do
formBegin
"
$tar_title
: Includes"
formItem
"Include:"
/etc
formItem
"Include:"
/home
formItem
"Include:"
/usr/local
formItem
"Include:"
formItem
"Include:"
formItem
"Include:"
formItem
"Include:"
formItem
"Include:"
formItem
"Include:"
formItem
"Include:"
formItem
"Include:"
formDisplay
[
$?
=
0
]
||
return
1
tar_includes
=
"includes = "
for
i
in
$REPLY
;
do
[
-n
"
$i
"
]
&&
tar_includes
=
"
$tar_includes
$i
"
done
done
REPLY
=
while
[
-z
"
$REPLY
"
]
;
do
formBegin
"
$tar_title
: Excludes"
formItem
"Exclude:"
/tmp
formItem
"Exclude:"
/proc
formItem
"Exclude:"
/sys
formItem
"Exclude:"
/dev
formItem
"Exclude:"
/srv
formItem
"Exclude:"
/media
formItem
"Exclude:"
/misc
formItem
"Exclude:"
/net
formItem
"Exclude:"
/selinux
formItem
"Exclude:"
formItem
"Exclude:"
formDisplay
[
$?
=
0
]
||
return
1
tar_excludes
=
"excludes = "
for
i
in
$REPLY
;
do
[
-n
"
$i
"
]
&&
tar_excludes
=
"
$tar_excludes
$i
"
done
done
# Save the config
get_next_filename
$configdirectory
/10.tar
cat
>
$next_filename
<<
EOF
$tar_when_run
$tar_backupname
$tar_backupdir
$tar_compress
$tar_includes
$tar_excludes
# tar binary - have to be GNU tar
#TAR=/bin/tar
#DATE /bin/date
#DATEFORMAT "%Y.%m.%d-%H%M"
EOF
chmod
600
$next_filename
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment