Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
4c646de6
Commit
4c646de6
authored
Jan 08, 2001
by
Leigh B. Stoller
Browse files
DB backup script to be run from cron everynight.
parent
b52ac391
Changes
5
Hide whitespace changes
Inline
Side-by-side
GNUmakefile.in
View file @
4c646de6
...
...
@@ -41,6 +41,7 @@ install-mkdirs:
-mkdir -p $(INSTALL_TOPDIR)/locks
-mkdir -p $(INSTALL_TOPDIR)/log
-mkdir -p $(INSTALL_TOPDIR)/lists
-mkdir -p $(INSTALL_TOPDIR)/backup
clean: clean-subdirs
distclean: distclean-subdirs
...
...
configure
View file @
4c646de6
...
...
@@ -921,7 +921,7 @@ esac
outfiles
=
"
$outfiles
Makeconf GNUmakefile
\
assign/GNUmakefile
\
capture/GNUmakefile
\
db/GNUmakefile db/nalloc db/nfree db/if2port
\
db/GNUmakefile db/nalloc db/nfree db/if2port
db/backup
\
discvr/GNUmakefile
\
lib/GNUmakefile
\
os/GNUmakefile os/imagezip/GNUmakefile
\
...
...
@@ -935,7 +935,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/ir/assign_wrapper tbsetup/ns2ir/GNUmakefile
\
tbsetup/ns2ir/postparse tbsetup/ir/handle_os tbsetup/ir/handle_ip
\
tbsetup/ns2ir/parse.tcl
\
tbsetup/tbprerun tbsetup/tbrun tbsetup/tbend
\
tbsetup/tbprerun tbsetup/tbrun tbsetup/tbend
tbsetup/tbreport
\
tbsetup/checkpass/GNUmakefile
\
tip/GNUmakefile
\
tmcd/GNUmakefile tmcd/tmcd.restart
\
...
...
configure.in
View file @
4c646de6
...
...
@@ -87,7 +87,7 @@ esac]
outfiles="$outfiles Makeconf GNUmakefile \
assign/GNUmakefile \
capture/GNUmakefile \
db/GNUmakefile db/nalloc db/nfree db/if2port \
db/GNUmakefile db/nalloc db/nfree db/if2port
db/backup
\
discvr/GNUmakefile \
lib/GNUmakefile \
os/GNUmakefile os/imagezip/GNUmakefile \
...
...
db/GNUmakefile.in
View file @
4c646de6
...
...
@@ -9,7 +9,7 @@ SUBDIR = db
include $(OBJDIR)/Makeconf
BIN_SCRIPTS = mac2if nalloc nfree nodeip
SBIN_SCRIPTS = avail inuse showgraph if2port
SBIN_SCRIPTS = avail inuse showgraph if2port
backup
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
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment