Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
marcus-lodspeakr
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uib-ub
Spesialsamlingene
marcus-lodspeakr
Commits
1fe60565
Commit
1fe60565
authored
13 years ago
by
alvaro
Browse files
Options
Downloads
Patches
Plain Diff
Added restore capabilities
parent
064002e5
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
utils/lodspk.sh
+6
-1
6 additions, 1 deletion
utils/lodspk.sh
utils/modules/backup.sh
+6
-2
6 additions, 2 deletions
utils/modules/backup.sh
utils/modules/getvar.php
+5
-0
5 additions, 0 deletions
utils/modules/getvar.php
utils/modules/restore.sh
+49
-0
49 additions, 0 deletions
utils/modules/restore.sh
with
66 additions
and
3 deletions
utils/lodspk.sh
+
6
−
1
View file @
1fe60565
...
@@ -9,7 +9,7 @@ if [[ $# -eq 0 || "$1" == "--help" ]]; then
...
@@ -9,7 +9,7 @@ if [[ $# -eq 0 || "$1" == "--help" ]]; then
fi
fi
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
operations
=(
create delete debug backup
)
operations
=(
create delete debug backup
restore
)
currentOperation
=
currentOperation
=
if
[[
${
operations
[@]
}
=
~
$1
]]
;
then
if
[[
${
operations
[@]
}
=
~
$1
]]
;
then
...
@@ -25,6 +25,11 @@ if [[ $currentOperation == "backup" ]]; then
...
@@ -25,6 +25,11 @@ if [[ $currentOperation == "backup" ]]; then
$DIR
/modules/backup.sh
$DIR
/modules/backup.sh
fi
fi
## Restore
if
[[
$currentOperation
==
"restore"
]]
;
then
$DIR
/modules/restore.sh
fi
## Create/delete
## Create/delete
if
[[
$currentOperation
==
"create"
||
$currentOperation
==
"delete"
]]
;
then
if
[[
$currentOperation
==
"create"
||
$currentOperation
==
"delete"
]]
;
then
modules
=(
type
service uri
)
modules
=(
type
service uri
)
...
...
This diff is collapsed.
Click to expand it.
utils/modules/backup.sh
+
6
−
2
View file @
1fe60565
#!/bin/bash
#!/bin/bash
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
BACKUPDIR
=
$HOME
/lodspeakr_backup
cd
$DIR
BASE
=
`
php getvar.php basedir
`
NAME
=
`
echo
$BASE
|sed
-e
's/^http:\/\///g'
-e
's/\/$//g'
-e
's/\//_/g'
`
cd
$DIR
/../..
cd
$DIR
/../..
BACKUPDIR
=
$HOME
/lodspeakr_backup
if
[[
!
-d
$BACKUPDIR
]]
;
then
if
[[
!
-d
$BACKUPDIR
]]
;
then
echo
"WARNING: No
$BACKUPDIR
dir. Creating it."
>
&2
echo
"WARNING: No
$BACKUPDIR
dir. Creating it."
>
&2
mkdir
$BACKUPDIR
mkdir
$BACKUPDIR
...
@@ -13,7 +17,7 @@ if [[ ! -d $BACKUPDIR ]]; then
...
@@ -13,7 +17,7 @@ if [[ ! -d $BACKUPDIR ]]; then
exit
1
exit
1
fi
fi
tmpFile
=
lodspeakr_
backup
_
`
date
+%Y%m%d%H%M%S
`
.tar.gz
tmpFile
=
$NAME
"-
backup
-"
`
date
+%Y%m%d%H%M%S
`
.tar.gz
tar
-czf
$tmpFile
settings.inc.php models views
tar
-czf
$tmpFile
settings.inc.php models views
...
...
This diff is collapsed.
Click to expand it.
utils/modules/getvar.php
0 → 100644
+
5
−
0
View file @
1fe60565
<?
//error_reporting(E_ERROR);
require_once
(
'../../settings.inc.php'
);
echo
$conf
[
$argv
[
1
]];
?>
This diff is collapsed.
Click to expand it.
utils/modules/restore.sh
0 → 100755
+
49
−
0
View file @
1fe60565
#!/bin/bash
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
cd
$DIR
BASE
=
`
php getvar.php basedir
`
NAME
=
`
echo
$BASE
|sed
-e
's/^http:\/\///g'
-e
's/\/$//g'
-e
's/\//_/g'
`
cd
$DIR
/../..
BACKUPDIR
=
$HOME
/lodspeakr_backup
if
[[
!
-d
$BACKUPDIR
]]
;
then
echo
"ERROR: No
$BACKUPDIR
dir."
>
&2
exit
1
fi
LIST
=(
`
ls
$BACKUPDIR
/
$NAME
-backup
*
`
)
CHOSEN
=
-1
while
[[
"
$CHOSEN
"
-lt
0
||
"
$CHOSEN
"
-ge
"
${#
LIST
[@]
}
"
]]
;
do
j
=
0
echo
echo
"Choose from the following available backups"
for
i
in
${
LIST
[@]
}
;
do
echo
"["
$j
"]"
`
basename
$i
`
let
j
=
$j
+1
done
echo
-n
"Select which backup to restore: "
read
-u
1 CHOSEN
done
echo
echo
"*** ATTENTION ***"
echo
"Are you sure you want to restore this backup? This may lead to overrite settings.inc.php, models/ and views/"
echo
-n
"(write 'yes' if you are sure): "
confirm
=
no
read
confirm
if
[[
"
$confirm
"
!=
"yes"
]]
;
then
echo
"Nothing done"
exit
0
fi
RESTORE
=
`
basename
${
LIST
[
$CHOSEN
]
}
`
echo
"Restoring "
$RESTORE
"..."
cp
${
LIST
[
$CHOSEN
]
}
.
tar
zxf
$RESTORE
if
[[
$?
-eq
0
]]
;
then
echo
Restore successful
else
echo
A problem occurred
in
the restoring process
fi
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