Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
4c646de6
Commit
4c646de6
authored
Jan 08, 2001
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DB backup script to be run from cron everynight.
parent
b52ac391
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
4 deletions
+61
-4
GNUmakefile.in
GNUmakefile.in
+1
-0
configure
configure
+2
-2
configure.in
configure.in
+1
-1
db/GNUmakefile.in
db/GNUmakefile.in
+1
-1
db/backup.in
db/backup.in
+56
-0
No files found.
GNUmakefile.in
View file @
4c646de6
...
@@ -41,6 +41,7 @@ install-mkdirs:
...
@@ -41,6 +41,7 @@ install-mkdirs:
-mkdir -p $(INSTALL_TOPDIR)/locks
-mkdir -p $(INSTALL_TOPDIR)/locks
-mkdir -p $(INSTALL_TOPDIR)/log
-mkdir -p $(INSTALL_TOPDIR)/log
-mkdir -p $(INSTALL_TOPDIR)/lists
-mkdir -p $(INSTALL_TOPDIR)/lists
-mkdir -p $(INSTALL_TOPDIR)/backup
clean: clean-subdirs
clean: clean-subdirs
distclean: distclean-subdirs
distclean: distclean-subdirs
...
...
configure
View file @
4c646de6
...
@@ -921,7 +921,7 @@ esac
...
@@ -921,7 +921,7 @@ esac
outfiles
=
"
$outfiles
Makeconf GNUmakefile
\
outfiles
=
"
$outfiles
Makeconf GNUmakefile
\
assign/GNUmakefile
\
assign/GNUmakefile
\
capture/GNUmakefile
\
capture/GNUmakefile
\
db/GNUmakefile db/nalloc db/nfree db/if2port
\
db/GNUmakefile db/nalloc db/nfree db/if2port
db/backup
\
discvr/GNUmakefile
\
discvr/GNUmakefile
\
lib/GNUmakefile
\
lib/GNUmakefile
\
os/GNUmakefile os/imagezip/GNUmakefile
\
os/GNUmakefile os/imagezip/GNUmakefile
\
...
@@ -935,7 +935,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
...
@@ -935,7 +935,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/ir/assign_wrapper tbsetup/ns2ir/GNUmakefile
\
tbsetup/ir/assign_wrapper tbsetup/ns2ir/GNUmakefile
\
tbsetup/ns2ir/postparse tbsetup/ir/handle_os tbsetup/ir/handle_ip
\
tbsetup/ns2ir/postparse tbsetup/ir/handle_os tbsetup/ir/handle_ip
\
tbsetup/ns2ir/parse.tcl
\
tbsetup/ns2ir/parse.tcl
\
tbsetup/tbprerun tbsetup/tbrun tbsetup/tbend
\
tbsetup/tbprerun tbsetup/tbrun tbsetup/tbend
tbsetup/tbreport
\
tbsetup/checkpass/GNUmakefile
\
tbsetup/checkpass/GNUmakefile
\
tip/GNUmakefile
\
tip/GNUmakefile
\
tmcd/GNUmakefile tmcd/tmcd.restart
\
tmcd/GNUmakefile tmcd/tmcd.restart
\
...
...
configure.in
View file @
4c646de6
...
@@ -87,7 +87,7 @@ esac]
...
@@ -87,7 +87,7 @@ esac]
outfiles="$outfiles Makeconf GNUmakefile \
outfiles="$outfiles Makeconf GNUmakefile \
assign/GNUmakefile \
assign/GNUmakefile \
capture/GNUmakefile \
capture/GNUmakefile \
db/GNUmakefile db/nalloc db/nfree db/if2port \
db/GNUmakefile db/nalloc db/nfree db/if2port
db/backup
\
discvr/GNUmakefile \
discvr/GNUmakefile \
lib/GNUmakefile \
lib/GNUmakefile \
os/GNUmakefile os/imagezip/GNUmakefile \
os/GNUmakefile os/imagezip/GNUmakefile \
...
...
db/GNUmakefile.in
View file @
4c646de6
...
@@ -9,7 +9,7 @@ SUBDIR = db
...
@@ -9,7 +9,7 @@ SUBDIR = db
include $(OBJDIR)/Makeconf
include $(OBJDIR)/Makeconf
BIN_SCRIPTS = mac2if nalloc nfree nodeip
BIN_SCRIPTS = mac2if nalloc nfree nodeip
SBIN_SCRIPTS = avail inuse showgraph if2port
SBIN_SCRIPTS = avail inuse showgraph if2port
backup
LIBEXEC_SCRIPTS = ptopgen
LIBEXEC_SCRIPTS = ptopgen
#
#
...
...
db/backup.in
0 → 100755
View file @
4c646de6
#!/usr/bin/perl -wT
use
English
;
#
# Configure variables
#
my
$TB
=
"
@prefix
@
";
my
$DBNAME
=
"
@TBDBNAME
@
";
my
$BACKUPDIR
=
"
$TB
/backup
";
# un-taint path
$ENV
{'
PATH
'}
=
'
/bin:/usr/bin:/usr/local/bin
';
delete
@ENV
{'
IFS
',
'
CDPATH
',
'
ENV
',
'
BASH_ENV
'};
#
# Only real root can call this.
#
if
(
$UID
!=
0
)
{
print
STDERR
"
You must be root to run this script!
\n
";
exit
(
-
1
);
}
if
(
!
chdir
(
$BACKUPDIR
))
{
print
STDERR
"
Could not chdir to
$BACKUPDIR
!
\n
";
exit
(
-
1
);
}
#
# Format the name of the backup with date.
# Untaint it since it was constructed with date. Dopey.
#
my
$name
=
"
tbdb-
"
.
`
date +20%y%m%d-%H.%M.%S
`;
if
(
$name
=~
/^([-\@\w.]+)$/
)
{
$name
=
$
1
;
}
#
# Do a mysqldump. This will reset the log files.
#
if
(
system
("
mysqldump --all --flush-logs --lock-tables
$DBNAME
>
$name
"))
{
print
STDERR
"
mysqldump failed!
\n
";
exit
(
1
);
}
#
# Compress it.
#
if
(
system
("
gzip
$name
"))
{
print
STDERR
"
gzip failed!
\n
";
exit
(
1
);
}
print
STDOUT
"
DB backup (
$DBNAME
) complete!
\n
";
exit
0
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment